3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[baserCMS] ブログのアイキャッチ画像の使い方

Last updated at Posted at 2014-08-28

baserCMSでブログのアイキャッチ画像を出力するには

    $this->Blog->eyeCatch($post, $options);

で出力できるのですが、

    if($this->Blog->getEyeCatch($post): 
      $this->Blog->eyeCatch($post, $options);
    endif;

とかするとアイキャッチがあるときだけ出力できます。

※ $optionsの部分は色々指定できるので、
http://baser-for-wper.tecking.org/functions/BlogHelper/blog_out/eye_catch
とかを参考にすると便利ですね!

具体的には、どんな風に使うかといいますと、

<?php if($this->Blog->getEyeCatch($post): ?>
<div class="xxxx">
<?php $this->Blog->eyeCatch($post, array('width'=>300)) ?>
</div>
<?php endif ?>

のような感じでアイキャッチ画像を別のタグなどで囲ったりする時なんかに便利です。:smile:

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?