WordPress.org

Ready to get started?Download WordPress

Forums

Yet Another Related Posts Plugin (YARPP)
Custom Template is not listed (2 posts)

  1. Nooster
    Member
    Posted 12 months ago #

    Hey guys,

    I'm using the newest version of YARPP. I developed a custom template for YARPP. The filename is yarpp-template-piwik.php and it is saved in the yarpp-templates directory.

    Unfortunately it is not listed in YARPP's backend for custom templates. In the dropdown list are only the preinstalled "custom"-templates. Is there anything I did wrong?

    I'm using WP-super-cache but I deactivated it. So it's obviously not the fault.

    Please help me, Nooster

    http://wordpress.org/plugins/yet-another-related-posts-plugin/

  2. Nooster
    Member
    Posted 12 months ago #

    Actually I just copied the content of the Thumbnail-Template and added a Piwik-campain to the permalink. This is a fullquote of ./yarpp-templates/yarpp-template-piwik.php

    <?php
    /*
    YARPP Template: Piwik and Thumbnails
    Description: Requires a theme which supports post thumbnails
    Author: bejonet
    */
    
    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();
    
    		$output .= "<a class='yarpp-thumbnail' href='" . get_permalink() . "?pk_campaign=referrer&pk_kwd=yarpp' title='" . the_title_attribute('echo=0') . "'>" . "\n";
    
    		$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'] );
    		}
    
    		if ( trim($post_thumbnail_html) != '' )
    			$output .= $post_thumbnail_html;
    		else
    			$output .= '<span class="yarpp-thumbnail-default"><img src="' . esc_url($thumbnails_default) . '"/></span>';
    
    		$output .= '<span class="yarpp-thumbnail-title">' . get_the_title() . '</span>';
    		$output .= '</a>' . "\n";
    
    	}
    	$output .= "</div>\n";
    } else {
    	$output .= $no_results;
    }
    
    $this->enqueue_thumbnails( $dimensions );

Reply

You must log in to post.

About this Plugin

About this Topic