Code Monkey home page Code Monkey logo

content-blocks's Introduction

Content Blocks FTW

Content Blocks are a content strategy for WordPress built with Timber and Advanced Custom Fields. No longer shall we create our WordPress sites with HTML in the content editor! Let's fill out nice fields and separate our concerns instead of adding <br>s everywhere. C'mon, we all do.

Naming Conventions

All views prefixed with an _ are extending something. Views partials, Sass partials, and ACF field names are mapped one to one for the most part.

Blocks

Blocks are structured chunks of content that remove the need for messy markup interspersed with your content. They are built using ACF Pro's Flexible Content Field.

block_text

General text block. Can be for large blocks of writing and contains options for headings.

  • block_text - WYSIWYG, Text Only toolbar

block_textimage

Display text next to an image. Can be a larger image with a caption or inline with the text.

  • textimage_format - Radio, caption or paragraph
  • textimage_paragraph - WYSIWYG, Text Only toolbar
  • textimage_caption - Textarea (should it be WYSIWYG with Link Only)?
  • textimage_image - Image

block_list

Block for either a free form list of content with an item description, title, and image OR a list of connected content. The connected content will display its featured image, post title, and excerpt.

  • list_title - Text
  • list_type - Radio, free_form or connected_content
  • list_display - Radio, major or minor
  • if free_form
    • list_type_freeform - Repeater
      • item_title - Text
      • item_description - WYSIWG Link Only
      • item_image - Image
  • if connected_content
    • list_type_connected_content - Relationship

block_quote

For blockquotes or testimonials.

  • quote_text - Textarea
  • quote_source - Text
  • quote_source_url - URL

block_cta

Call to action containing a button.

  • cta_text - Text
  • cta_btn_text - Text
  • cta_btn_url - URL

block_html

For standard markup or shortcodes.

  • html - WYSIWG text only, no formatting.

Base Views

Each directory of views contains a base view that is extended by its variations e.g. block.twig is extended by _block-text.twig. These are then included in primary templates with context variables. The following notes document the context variables each base template accepts.

(Is this too abstracted? Whatever, it's fun.)

headers/header.twig

Contains 3 context variables (is that the correct term?):

  1. contain: Conditionall prints a container within the <header> tags. Takes a string for the class name, should be contain-[size].
  2. class: And class names for the <header>. Should be BEMmy (I think), like header--site.
  3. role: An ARIA role if necessary. Just the text for the role, so banner, etc.

blocks/block.twig

...

teases/tease.twig

...

pages/page.twig

...

singles/single.twig

...

footers/footer.twig

...

Getting Started

Coming soon.

content-blocks's People

Contributors

laras126 avatar racedale avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.