07/11/2013 at 10:00 am
#264674
Guest
Hi Steven,
I tried to use the ‘Names’ template as a basis, but my new template is not recognized.
I kept it identical to the names plugion, however replaced all occurences of ‘Names’ with ‘Test’.
Here my plugion version:
Versions-Informationen
WordPress: 3.5.2
Multisite: No
Connections: 0.7.7.1
Database: 0.1.9
The plugin:
directory: ‘test’
filename: ‘test.php’
code:
<?php
if ( ! class_exists( 'cnTest' ) ) {
class cnTest {
public static function init() {
$atts = array(
'class' => 'CN_Test',
'name' => 'Test',
'type' => 'all',
'version' => '1.0',
'author' => 'Patrick',
'authorURL' => 'example.com',
'description' => 'Description.',
'path' => plugin_dir_path( __FILE__ ),
'parts' => array( 'css' => 'style.css' )
);
cnTemplateFactory::register( $atts );
}
}
class CN_Test {
public function __construct( $template ) {
$this->template = $template;
$template->part( array( 'tag' => 'card', 'type' => 'action', 'callback' => array( $this, 'card' ) ) );
$template->part( array( 'tag' => 'css', 'type' => 'action', 'callback' => array( $template, 'printCSS' ) ) );
}
public function card( $entry ) {
$entry->getNameBlock( array( 'link' => TRUE ) );
}
}
}
