lambry/bloc 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

lambry/bloc

Composer 安装命令:

composer require lambry/bloc

包简介

A few useful WordPress blocks and block options.

README 文档

README

A few useful WordPress blocks and block options.

composer require lambry/bloc

Options

Extensions to core blocks for a little extra functionality.

Features

  • Shift: Choose to shift the block up or down.
  • Padding: Add padding to any and all sides of a block.
  • Max width: Limit the block to maximum width.
  • Animate in: Fade in a block when it's scrolled into view.
  • Retrict to: Only show blocks for certain user roles.
  • Visibility: Hide blocks for certain screen sizes.

options

Custom properties

:root {
	--bloc-shift-up: -5rem;
	--bloc-shift-down: -5rem;
	--bloc-padding-sm: 1rem;
	--bloc-padding-md: 2.5rem;
	--bloc-padding-lg: 5rem;
	--bloc-max-width-sm: 30rem;
	--bloc-max-width-md: 40rem;
	--bloc-max-width-lg: 50rem;
	--bloc-animation-duration: 1s;
	--bloc-animation-distance: 1rem;
	--bloc-animation-easing: cubic-bezier(0.46, 0.03, 0.52, 0.96);
}

Grid

Block to display content in a grid of rows and columns.

Features

  • Display any number of items.
  • Choose the number columns to show at different screen sizes.
  • Add or remove spacing between columns.
  • Choose the number of columns and rows any individual cell should span.

grid

Custom properties

:root {
	--bloc-grid-gap: 2rem;
}

Slider

Block to display content in a slider, or carousel (i.e. a slider with multiple slides shown at once).

Features

  • Display any number of slides.
  • Choose the number slides to show a once at different screen sizes.
  • Optionally add a background image to each slide.
  • Optionally link the entire slide.
  • Choose between slide and fade effects.
  • Loop slides for an inifitnte slider.
  • Show or hide the navigation arrows.
  • Show or hide the pagination i.e. bullets.
  • Add or remove spacing between slides.

slider

Custom properties

:root {
	--bloc-slider-gap: 2rem;
	--bloc-slider-speed: 250ms;
	--bloc-slider-theme: currentColor;
}

Posts

Block for fetching posts, pages and custom post types and displaying them in a grid, slider or accordion.

Features

  • Fetch any posts, pages or custom post types.
  • Filter by any taxonomies, terms and custom fields.
  • Optionally offset posts or include sticky posts.
  • Choose specific pages, or show all subpages for said pages.
  • Order by ID, published date, modified date, title, slug, menu order, random or even a custom field.
  • Choose the number of results to display per row at different screen sizes, as well the total number of results to show.
  • Slider only options include: autoplay, loop, navigation and pagination.
  • Accordion only options include: open first item and open one at a time.

With the posts block you could choose to show all fantasy books sorted by price that are less than $20, or properties that feature waterfront views, have 3 or more bedroom and are sorted by land size.

posts

Templates

You can override any aspect of the display by adding template files in a folder called bloc/posts/, the basic template heirarchy is:

  • grid.php, slider.php and accordion.php will override the main template/wrapper for those display types.
  • grid-item.php, slider-item.php and accordion-item.php will override the template/display for individual posts within those display types.
  • grid-item-{post-type}.php, slider-item-{post-type}.php and accordion-item-{post-type}.php will override the template by post type, for example grid-item-post.php will override grid-item.php for posts and slider-item-page.php would override slider-item.php for pages.

Custom properties

:root {
	--bloc-posts-gap: 2rem;
	--bloc-posts-slider-speed: 500ms;
	--bloc-posts-slider-theme: currentColor;
	--bloc-posts-accordion-easing: cubic-bezier(0.46, 0.03, 0.52, 0.96);
	--bloc-posts-accordion-duration: 250ms;
}

Filters

<?php
// Filter to modify the main posts query arguments.
add_filter('bloc/posts/query', fn(array $args) => array_merge($args, ['author_name' => 'admin']));

// Filter to set the no results i.e empty message.
add_filter('bloc/posts/empty', function(string $message, string $display) {
    return __('Sorry, there were no matching results.');
}, 10, 2);

lambry/bloc 适用场景与选型建议

lambry/bloc 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「plugin」 「wordpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 lambry/bloc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 lambry/bloc 我们能提供哪些服务?
定制开发 / 二次开发

基于 lambry/bloc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2022-05-29