前提
YARPP 4.2.4で動作確認
- mythemeをテーマとして使っている
- テーマディレクトリ直下にテンプレのファイルが置いてある
- 例: /path/to/wordpress/wp-content/themes/mytheme/yarpp-template-myapp.php
コード
related_posts(array('template' => 'yarpp-template-myapp.php'));
YARPPの3系とかは下の指定方法だった模様。ググってヒットするものが下のような例ばかりで動かず、結局コードみた。
related_posts(array('template_file' => 'yarpp-template-myapp.php'));
related_posts(array('use_template' => true, 'template_file' => 'yarpp-template-myapp.php'));
参考
古いoptionを新しい仕様に更新している箇所
# wp-content/plugins/yet-another-related-posts-plugin/includes/yarpp_options.php
125 $new_options['template'] = $_POST['use_template'] == 'custom' ? $_POST['template_file'] :
126 ( $_POST['use_template'] == 'thumbnails' ? 'thumbnails' : false );
127 $new_options['rss_template'] = $_POST['rss_use_template'] == 'custom' ? $_POST['rss_template_file'] :
128 ( $_POST['rss_use_template'] == 'thumbnails' ? 'thumbnails' : false );