summaryrefslogtreecommitdiff
path: root/yarpp-template-custom-thumbnails.php
diff options
context:
space:
mode:
authorMax2018-10-15 23:46:42 +0200
committerMax2018-10-15 23:46:42 +0200
commit00c9709fd9763542e848f6278db8ba26af5c9886 (patch)
tree92cb1c1ee4c467118e1e5a4c7e233d3feac6efa8 /yarpp-template-custom-thumbnails.php
downloadfuselkoenig_de-00c9709fd9763542e848f6278db8ba26af5c9886.tar.gz
Initial commit.
Diffstat (limited to 'yarpp-template-custom-thumbnails.php')
-rw-r--r--yarpp-template-custom-thumbnails.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/yarpp-template-custom-thumbnails.php b/yarpp-template-custom-thumbnails.php
new file mode 100644
index 0000000..66cc103
--- /dev/null
+++ b/yarpp-template-custom-thumbnails.php
@@ -0,0 +1,71 @@
+<?php
+/*
+ * RPP's built-in thumbnails template
+ * customized by me
+ * @since 4
+ *
+ * This template is used when you choose the built-in thumbnails option.
+ * If you want to create a new template, look at yarpp-templates/yarpp-template-example.php as an example.
+ * More information on the custom templates is available at http://mitcho.com/blog/projects/yarpp-3-templates/
+ */
+
+
+$__origin_title = get_the_title();
+
+if ( !$this->diagnostic_using_thumbnails() )
+ $this->set_option( 'manually_using_thumbnails', true );
+
+$options = array( 'thumbnails_heading', 'thumbnails_default', 'no_results' );
+extract( $this->parse_args( $args, $options ) );
+
+// a little easter egg: if the default image URL is left blank,
+// default to the theme's header image. (hopefully it has one)
+if ( empty($thumbnails_default) )
+ $thumbnails_default = get_header_image();
+
+$dimensions = $this->thumbnail_dimensions();
+
+$output .= '<h3>' . $thumbnails_heading . '</h3>' . "\n";
+
+if (have_posts()) {
+ $output .= '<div class="yarpp-thumbnails-horizontal">' . "\n";
+ while (have_posts()) {
+ the_post();
+
+ $__get_the_title = get_the_title();
+
+ $output .= "<a data-clean-title='".get_my_clean_title($__get_the_title)."' data-origin-post='".get_my_clean_title($__origin_title)."' class='yarpp-thumbnail' href='" . get_permalink() . "' title='" . the_title_attribute('echo=0') . "'>" . "\n";
+
+// onclick='javascript:_paq.push([\"trackEvent\", \"related post\", \"" . get_my_clean_title($__get_the_title) . "\"]);'
+
+ $post_thumbnail_html = '';
+ if ( has_post_thumbnail() ) {
+ if ( $this->diagnostic_generate_thumbnails() )
+ $this->ensure_resized_post_thumbnail( get_the_ID(), $dimensions );
+ $post_thumbnail_html = get_the_post_thumbnail( null, $dimensions['size'], array( 'class' => 'img-thumbnail') );
+
+ /**
+ * replaces all images on fuselkönig.de by a image server, which croppes them nicely
+ */
+ #$post_thumbnail_html = str_replace('https://www.fuselkoenig.de', 'https://www.fuselkoenig.de/crop?width=240&height=240&gravity=centre&url=https://www.fuselkoenig.de', $post_thumbnail_html);
+
+ $post_thumbnail_html = str_replace('https://www.fuselkoenig.de', '/crop/240/240/centre', $post_thumbnail_html);
+ }
+
+ if ( trim($post_thumbnail_html) != '' )
+ $output .= $post_thumbnail_html;
+ else
+ $output .= '<span class="yarpp-thumbnail-default"><img class="img-thumbnail" src="' . esc_url($thumbnails_default) . '"/></span>';
+
+ #$output .= '<span class="yarpp-thumbnail-title">' . str_replace('Im Test: ', '', get_the_title()) . '</span>';
+ $output .= '<span class="yarpp-thumbnail-title">' . get_my_clean_title( $__get_the_title ) . '</span>';
+ $output .= '</a>' . "\n";
+
+ }
+ $output .= "</div>\n";
+} else {
+ $output .= $no_results;
+}
+
+$this->enqueue_thumbnails( $dimensions );
+