Skip to content

DKPDF Customizations

This allows to change filename, layout, pagination and other stuff for the DKPF plugin.

//PDF CHANGES
//change filename
function custom_dkpdf_pdf_filename( $filename ) {
  $current_user = get_the_author_meta('display_name');
  $filename = 'Telekanzlei - Checkliste - '.get_the_title();
  return $filename;
}
add_filter( 'dkpdf_pdf_filename', 'custom_dkpdf_pdf_filename' );

//add title
/*
function changing_dkpdf_header_title( $title ) {
	if ( have_posts() ) : while ( have_posts() ) : the_post();
		$title = ''.get_the_author_meta( 'display_name' );
	endwhile; else:
		endif;
	return $title;
}
add_filter( 'dkpdf_header_title', 'changing_dkpdf_header_title' );
*/

//content before
function custom_dkpdf_before_content() {
	$output = '<h1 class="single-post-title entry-title" style="font-family: Roboto,Helvetica Neue,Arial,sans-serif; font-weight: 400; color: #015d8f;">'.get_the_title().'</h1>';
	return $output;
}
add_filter( 'dkpdf_before_content', 'custom_dkpdf_before_content' );

//content after
/*
function custom_dkpdf_after_content() {
	$output = '<div style="margin-top:25px;width:100%;background:#CCC; text-align:center">Dies ist der Download eines Patterns vom Patternpool.</div>';
	return $output;
}
add_filter( 'dkpdf_after_content', 'custom_dkpdf_after_content' );
*/

//pagination header
function changing_dkpdf_header_pagination( $content ) {
	$content = 'Telekanzlei Lindow & Partner | Seite {PAGENO} von {nb}';
	return $content;
}
add_filter( 'dkpdf_header_pagination', 'changing_dkpdf_header_pagination' );

// pagination footer
function changing_dkpdf_footer_pagination( $content ) {
	$content = ' | Seite {PAGENO} von {nb}';
	return $content;
}
add_filter( 'dkpdf_footer_pagination', 'changing_dkpdf_footer_pagination' );


function dkpdfg_hide_button_isset() {
	return isset( $_POST['dkpdfg_action_create'] ) || isset( $_POST['dkpdfg_action_create_categories'] );
}
add_filter( 'dkpdf_hide_button_isset', 'dkpdfg_hide_button_isset' );
function dkpdfg_hide_button_equal() {
	return $_POST['dkpdfg_action_create'] == 'dkpdfg_action_create' || $_POST['dkpdfg_action_create_categories'] == 'dkpdfg_action_create_categories';
}
add_filter( 'dkpdf_hide_button_equal', 'dkpdfg_hide_button_equal' );

function dkpdf_remove_shortcodes_bytag( $content ) {
	$pdf = get_query_var( 'pdf' );
	if( $pdf ) {
		//remove_shortcode( 'dkpdf-columns' );
		//remove_shortcode( '/dkpdf-columns' );
		//remove_shortcode( 'dkpdf-columnbreak' );
		remove_shortcode( 'dkpdf-button' );

		//add_shortcode('dkpdf-columns', '__return_false');
		//add_shortcode('/dkpdf-columns', '__return_false');
		//add_shortcode('dkpdf-columnbreak', '__return_false');
		add_shortcode('dkpdf-button', '__return_false');
	}
	return do_shortcode($content);
}
add_filter( 'the_content', 'dkpdf_remove_shortcodes_bytag');


//https://gist.github.com/wpmudev-sls/639f2b6d711016e74ffa86d3a8e3c0d3

http://wp.dinamiko.com/demos/dkpdf/doc/remove-shortcodes-in-pdf/?recsys=1924

Dieser Beitrag hat 0 Kommentare

Schreibe einen Kommentar

Deine E-Mail wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

An den Anfang scrollen