Skip to content

Conversation

@crftwrk
Copy link
Member

@crftwrk crftwrk commented Oct 5, 2025

Heavy WIP!

https://themes.bootscore.me/boilerplate/plugins/bs-swiper/

Shortcodes

Templates

  • Rewrite localize template script to omit the -main suffix fallback. b7cb101

Loop

Options/init.js

Related posts

  • Add a new hook to single templates and use this instead <?php if (function_exists('bootscore_related_posts')) bootscore_related_posts(); ?>, Add deprecated notice.
  • Add filters and actions like shortcodes
  • Add related products? Closes Related products like related posts #81

CSS

  • Beautify the bullet navigation c6512a8

General

  • Release a final v5 version which disables the auto-updater
  • Readd the PUC
  • Update the README.md
  • Update docs
  • Release post

If plugin becomes commercial

  • Create a product
  • Set repo to private or archive and create a new one?
  • Contact contributors (free)
  • Create a free v5 version file
  • Check support form
  • Check plugin repo links
  • Remove from packagist

If not

  • Readd composer

Filters

Contextual filter examples

Image Overlay slider overlay
[bs-swiper layout="columns" type="post" category="post-templates" context="custom-card-overlay" excerpt="false" categories="false" tags="false" meta="false" readmore="false"]
// custom card-overlay
[data-context="custom-card-overlay"] {

  // Change the swiper theme color
  --swiper-theme-color: var(--#{$prefix}body-color);

  // Make the shadow visible by using padding and negative margin, .swiper has class overflow: hidden;
  margin-left: -12px;
  margin-right: -12px;

  .swiper {
    padding-left: 12px;
    padding-right: 12px;
  }
}
/**
 * Card overlay
 */

// Change bs-swiper-wrapper padding-bottom class
// Add mb-5 spacer to the cards instead to show the shadow
function change_card_overlay_bs_swiper_wrapper_padding_bottom($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "";
  }
  return $class;
}
add_filter('bootscore/bs-swiper/class/wrapper/padding-bottom', 'change_card_overlay_bs_swiper_wrapper_padding_bottom');

// Card class
function change_card_overlay($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "card border-0 shadow bg-dark h-auto rounded-4 overflow-hidden mb-5";
  }
  return $class;
}
add_filter('bootscore/class/loop/card', 'change_card_overlay');


// Card-img class
function change_card_overlay_img($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "card-img";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/image', 'change_card_overlay_img');


// Card-body class
function change_card_overlay_body($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "card-img-overlay d-flex flex-column";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/body', 'change_card_overlay_body');


// Card heading link class
function change_card_overlay_heading_link($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "text-decoration-none mt-auto stretched-link";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/title/link', 'change_card_overlay_heading_link');


// Card heading class
function change_card_overlay_heading($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    return "text-white h3 lh-1 fw-bold";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/title', 'change_card_overlay_heading');


//Add author gravatar and date after title for custom-card-overlay context
function add_custom_card_overlay_meta($location) {
  // Only run if we're in the swiper shortcode with custom-card-overlay context
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-card-overlay') {
    ?>
    <div class="custom-card-overlay-meta d-flex align-items-center gap-2 mt-2 text-white">
      <!-- Author Gravatar -->
      <div class="author-avatar">
        <?php 
        echo get_avatar(
          get_the_author_meta('ID'),
          32,
          '',
          '',
          array('class' => 'rounded-circle border border-white shadow')
        ); 
        ?>
      </div>

      <!-- Date -->
      <div class="post-date small ms-auto">
        <i class="fa-solid fa-calendar-days"></i> <span><?php echo get_the_date(); ?></span>
      </div>
    </div>
    <?php
  }
}
add_action('bootscore_after_loop_title', 'add_custom_card_overlay_meta');
Vertical overlay slider overlay-vertical
[bs-swiper layout="columns" type="post" category="swiper-demo-posts" context="custom-vertical-card-overlay" meta="false" tags="false"]
// Vertical overlay cards
[data-context="custom-vertical-card-overlay"] {
  // Change the swiper theme color
  --swiper-theme-color: var(--#{$prefix}body-color);

  // Make the shadow visible by using padding and negative margin, .swiper has class overflow: hidden;
  margin-left: -12px;
  margin-right: -12px;

  .swiper {
    padding-left: 12px;
    padding-right: 12px;
  }

  .backdrop-blur {
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
  }
}
/**
 * Vertical card overlay
 */

// Change bs-swiper-wrapper padding-bottom class
// Add mb-5 spacer to the cards instead to show the shadow
function change_vertical_card_overlay_bs_swiper_wrapper_padding_bottom($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "";
  }
  return $class;
}
add_filter('bootscore/bs-swiper/class/wrapper/padding-bottom', 'change_vertical_card_overlay_bs_swiper_wrapper_padding_bottom');


// Card class
function change_vertical_card_overlay($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "card border-0 shadow bg-dark h-auto rounded-5 overflow-hidden mb-5";
  }
  return $class;
}
add_filter('bootscore/class/loop/card', 'change_vertical_card_overlay');


// Card-img class
function change_vertical_card_overlay_img($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "card-img";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/image', 'change_vertical_card_overlay_img');


// Card-body class
function change_vertical_card_overlay_body($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "card-img-overlay d-flex flex-column";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/body', 'change_vertical_card_overlay_body');


// Open wrapper div for vertical cards context before loop title
function vertical_cards_open_overlay_wrapper($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    echo '<div class="bg-black bg-opacity-25 backdrop-blur rounded-5-inner p-3 p-md-4 shadow mt-auto">';
  }
}
add_action('bootscore_before_loop_title', 'vertical_cards_open_overlay_wrapper');


// Change category badge class
function vertical_cards_change_category_badge_link_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "custom-category badge bg-dark bg-opacity-25 backdrop-blur text-decoration-none text-white fw-lighter rounded-pill p-2 px-3 mt-2 ms-2 shadow";
  }
  return $class;
}
add_filter('bootscore/class/badge/category', 'vertical_cards_change_category_badge_link_class');


// Change heading class
function vertical_cards_change_heading_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "h5 text-white text-uppercase fw-lighter mb-3";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/title', 'vertical_cards_change_heading_class');


// Change excerpt class
function vertical_cards_change_excerpt_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "small lh-sm fw-lighter";
  }
  return $class;
}
add_filter('bootscore/class/loop/card-text/excerpt', 'vertical_cards_change_excerpt_class');

// Change excerpt link class
function vertical_cards_change_excerpt_link_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "text-decoration-none text-white";
  }
  return $class;
}
add_filter('bootscore/class/loop/card-text/excerpt/link', 'vertical_cards_change_excerpt_link_class');


// Change read-more class
function vertical_cards_change_read_more_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    return "btn btn-outline-light btn-sm rounded-pill w-100";
  }
  return $class;
}
add_filter('bootscore/class/loop/read-more', 'vertical_cards_change_read_more_class');


// Close wrapper div for vertical cards context after loop tags
function vertical_cards_close_overlay_wrapper($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'custom-vertical-card-overlay') {
    echo '</div>';
  }
}
add_action('bootscore_after_loop_tags', 'vertical_cards_close_overlay_wrapper');
Tailwind style slider tailwind
[bs-swiper layout="columns" type="post" category="post-templates" context="tailwind-cards" meta="false" tags="false" readmore="false" slidesperview="1,1,2,3,3,3"]
// Tailwind style cards
[data-context="tailwind-cards"] {

  // Change the swiper theme color
  --swiper-theme-color: var(--#{$prefix}body-color);

  // Make the shadow visible by using padding and negative margin, .swiper has class overflow: hidden;
  margin-left: -12px;
  margin-right: -12px;

  .swiper {
    padding-left: 12px;
    padding-right: 12px;
  }
}

// Image inner border-radius
.rounded-5-inner {
  border-radius: $border-radius * 4;
}

// Create a custom dark/light button that changes on data-bs-theme="dark"
.btn-custom {
  color: var(--#{$prefix}gray-100);
  background-color: var(--#{$prefix}gray-900);
  border-color: var(--#{$prefix}gray-900);

  &:hover {
    color: var(--#{$prefix}gray-100);
    background-color: var(--bs-gray-700);
    border-color: var(--bs-gray-700);
  }
}


[data-bs-theme="dark"] {
  .btn-custom {
    color: var(--#{$prefix}gray-900);
    background-color: var(--#{$prefix}gray-100);
    border-color: var(--#{$prefix}gray-100);

    &:hover {
      color: var(--#{$prefix}gray-900);
      background-color: var(--#{$prefix}gray-300);
      border-color: var(--#{$prefix}gray-300);
    }
  }
}
/**
 * Tailwind style cards
 */

//Change responsive wrapper class
function swiper_responsive_navigation_wrapper_spacer($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "px-xl-5";
  }
  return $class;
}
add_filter('bootscore/bs-swiper/class/wrapper/padding-x', 'swiper_responsive_navigation_wrapper_spacer');


// Change bs-swiper-wrapper padding-bottom class
// Add mb-5 spacer to the cards instead to show the shadow
function change_tailwind_card_bs_swiper_wrapper_padding_bottom($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "";
  }
  return $class;
}
add_filter('bootscore/bs-swiper/class/wrapper/padding-bottom', 'change_tailwind_card_bs_swiper_wrapper_padding_bottom');


// Card class
function change_tailwind_card($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "card shadow h-auto rounded-5 mb-5";
  }
  return $class;
}
add_filter('bootscore/class/loop/card', 'change_tailwind_card');


// Change responsive navigation arrow class
function swiper_responsive_navigation_arrows($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "d-none d-xl-block";
  }
  return $class;
}
add_filter('bootscore/bs-swiper/class/navigation', 'swiper_responsive_navigation_arrows');



// Show custom tags before thumbnail for tailwind-cards context
function tailwind_cards_custom_tags_before_thumbnail($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    $tags = get_the_tags();

    if ($tags) {
      echo '<div class="custom-tags-wrapper d-flex flex-wrap gap-1 position-absolute top-0 start-0 mt-4 ms-4">';
      foreach ($tags as $tag) {
        echo '<span class="custom-tag badge bg-dark bg-opacity-25 text-white rounded-pill fw-lighter p-2">';
        echo '<i class="fa-solid fa-tag me-1"></i>'; // Font Awesome icon
        echo esc_html($tag->name);
        echo '</span>';
      }
      echo '</div>';
  }
  }
}
add_action('bootscore_before_loop_thumbnail', 'tailwind_cards_custom_tags_before_thumbnail');


// Open wrapper div for tailwind-cards context before thumbnail
function tailwind_cards_open_thumbnail_wrapper($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    echo '<div class="pt-2 px-2">';
  }
}
add_action('bootscore_before_loop_thumbnail', 'tailwind_cards_open_thumbnail_wrapper');

// Change loop thumbnail class
function swiper_loop_thumbnail($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "rounded-5-inner";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/image', 'swiper_loop_thumbnail');

// Close wrapper div for tailwind-cards context after thumbnail  
function tailwind_cards_close_thumbnail_wrapper($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    echo '</div>';
  }
}
add_action('bootscore_after_loop_thumbnail', 'tailwind_cards_close_thumbnail_wrapper');


// Change card-body class
function tailwind_cards_card_body($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "card-body p-4 d-flex flex-column";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/body', 'tailwind_cards_card_body');



// Change category badge class
function tailwind_cards_change_category_badge_link_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "small text-body-secondary text-uppercase fw-lighter text-decoration-none";
  }
  return $class;
}
add_filter('bootscore/class/badge/category', 'tailwind_cards_change_category_badge_link_class');


// Change heading class
function tailwind_cards_change_heading_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "h3";
  }
  return $class;
}
add_filter('bootscore/class/loop/card/title', 'tailwind_cards_change_heading_class');

// Change excerpt class
function tailwind_cards_change_excerpt_class($class) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    return "small fw-lighter";
  }
  return $class;
}
add_filter('bootscore/class/loop/card-text/excerpt', 'tailwind_cards_change_excerpt_class');



// Add custom footer with date and button for tailwind-cards context
function tailwind_cards_custom_footer($location) {
  if (!empty($GLOBALS['bs_swiper_context']) && $GLOBALS['bs_swiper_context'] === 'tailwind-cards') {
    ?>
    <div class="card-text d-flex align-items-center mt-auto">
      <div class="post-date small text-body-secondary fw-lighter">
        <i class="fa-solid fa-calendar-days"></i> <span><?php echo get_the_date(); ?></span>
      </div>

      <a class="btn btn-sm btn-custom rounded-pill shadow px-3 ms-auto" href="<?php the_permalink(); ?>">
        Learn more <i class="fa-solid fa-arrow-right"></i>
      </a>
    </div>
    <?php
  }
}
add_action('bootscore_after_loop_tags', 'tailwind_cards_custom_footer');

@crftwrk crftwrk marked this pull request as draft October 5, 2025 10:57
@crftwrk crftwrk added this to v6.4.0 and v7 Oct 5, 2025
@crftwrk crftwrk moved this to Todo in v6.4.0 Oct 5, 2025
@crftwrk crftwrk moved this to Todo in v7 Oct 5, 2025
@crftwrk crftwrk self-assigned this Oct 7, 2025
@crftwrk crftwrk added documentation Improvements or additions to documentation feature labels Oct 8, 2025
crftwrk and others added 27 commits October 11, 2025 13:09
…shortcode-selector

Change shortcode selector and add hero templates
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature

Projects

Status: Todo
Status: Todo

2 participants