Skip to content

Instantly share code, notes, and snippets.

View Dinamiko's full-sized avatar
💭
just coding stuff

Emili Castells Dinamiko

💭
just coding stuff
View GitHub Profile
<?php
if( get_field('post_name') ) { ?>
<p><?php echo get_field('post_name');?></p>
<?php }
$image = get_field('post_image');
if( !empty($image) ): ?>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<?php endif; ?>
<html>
<head>
<link type="text/css" rel="stylesheet" href="<?php echo get_bloginfo( 'stylesheet_url' ); ?>" media="all" />
<?php
$wp_head = get_option( 'dkpdf_print_wp_head', '' );
if( $wp_head == 'on' ) {
wp_head();
}
?>
<style type="text/css">
<?php echo do_shortcode('[dkpdf-button]'); ?>
<?php
function changing_dkpdf_pdf_format( $format ) {
$format = 'Royal';
return $format;
}
add_filter( 'dkpdf_pdf_format', 'changing_dkpdf_pdf_format' );
<?php
function changing_dkpdf_header_title( $title ) {
if ( have_posts() ) : while ( have_posts() ) : the_post();
$title .= ' by ' . get_the_author_meta( 'display_name' );
endwhile; else:
endif;
return $title;
}
add_filter( 'dkpdf_header_title', 'changing_dkpdf_header_title' );
<img src="http://dkpdfg-book.dev/wp-content/uploads/2016/03/abbott-david-p.jpg" />
<p style="width:100%;">Credits: <a href="http://www.readbookonline.net/stories/Abbott/1189/">readbookonline</a> & <a href="https://unsplash.com">unsplash</a></p>
<body>
<?php
// get selected posts
$dkpdfg_selected_posts = get_option( 'dkpdfg_selected_posts', array() );
// print_r($dkpdfg_selected_posts); Array ( [0] => 9031 [1] => 391 [2] => 598 [3] => 495 )
$inserted = array(9032);
array_splice( $dkpdfg_selected_posts, 2, 0, $inserted ); // added to position 2
<div style="width:100%;float:left;">
<img src="http://path/to/myimage.jpg">
</div>
<?php
global $post;
if( $post->ID == 2125 ) {
// first update options
$ids = array(2125, 735, 733, 4, 2349);
update_option( 'dkpdfg_custom_ids', $ids );
$cover = '<html><head>';
<?php
function custom_dkpdf_before_content() {
$output = '<div style="margin-bottom:25px;width:100%;background:#CCC;">Before content text</div>';
return $output;
}
add_filter( 'dkpdf_before_content', 'custom_dkpdf_before_content' );
function custom_dkpdf_after_content() {
$output = '<div style="margin-top:25px;width:100%;background:#CCC;">After content text</div>';
return $output;