how to add bootstrap readmore button to teaser in drupal 8

3
(1)

Small snippet to add bootstrap button to teaser in drupal 8

In the theme file. Add this function:

/**
 * Implements template_preprocess_links()
 */
function THEME_NAME_preprocess_links(&$variables) {
  $variables['links']['node-readmore']['link']['#options']['attributes']['class'][] = 'btn btn-primary';
  $variables['links']['comment-add']['link']['#options']['attributes']['class'][] = 'btn btn-primary';
}

Then clear cache & refresh main page.

Similar Posts:

528

How useful was this post?

Click on a star to rate it!

Average rating 3 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

Scroll to Top