Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/samrap/acf-fluent

✒️ A fluent interface for the Advanced Custom Fields WordPress plugin
https://github.com/samrap/acf-fluent

acf acf-field advanced-custom-fields fluent fluent-interface wordpress

Last synced: 6 days ago
JSON representation

✒️ A fluent interface for the Advanced Custom Fields WordPress plugin

Awesome Lists containing this project

README

        




Build Status
Code Quality
Packagist Version
MIT License

**Are you using ACF Fluent?**

ACF Fluent is almost at 8000 downloads, which I think is pretty cool! I mean, it's not _a ton_ of downloads, but cool nonetheless. If you're using it, I would love to hear your feedback. [Shoot me an email](mailto:[email protected]) and let me know what kind of projects you've used it on :). While I'm not working on it actively at this time, I'm still happy to maintain it.

### What is ACF Fluent?

ACF Fluent is a [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface) for the Advanced Custom Fields WordPress plugin. It enables theme developers to create custom field "queries" using an expressive, fluent interface that makes templating with ACF a breeze.

### Why?

If you make heavy use of Advanced Custom Fields in your WordPress templates (you should), then you probably find yourself writing a lot of repetitive code just to print out your fields. For example, you might have a `heading` field for your page's hero section:

```php

= $heading ?>


```

As you know, this type of template coding will clutter up your template files quickly, turning your well-structured HTML into a mess of PHP tags and blocks. The worst part is, you'll find yourself not only in a clutter of PHP logic, but repeating the same logic over and over!

ACF Fluent aims to minimize the mess with a fluent builder that lets you easily get and update fields and sub fields and add constraints along the way. Let's take a look at the same functionality above, using ACF Fluent:

```php
default(get_the_title())
->escape()
->get();

?>

= $heading ?>

```

Interested? ACF Fluent packs a lot more features and has **no** dependencies. [Check out the docs](docs/01-basic-usage.md) see all of the awesome features.

### Documentation

- [Basic Usage](docs/01-basic-usage.md)
- [Builder Methods](docs/02-builder-methods.md)
- [Updating Fields](docs/03-updating-fields.md)
- [Macros](docs/04-macros.md)

### Contributing

ACF Fluent is still in its early stages. Issues, PRs, and enhancement ideas are encouraged and appreciated.

---

![Tweeter](http://i.stack.imgur.com/IWyBR.png) Built by [@thesamrapaport](https://twitter.com/thesamrapaport), [samrapaport.com](https://samrapaport.com)

The ACF logo is owned by [Elliot Condon](http://www.elliotcondon.com/) and the [Advanced Custom Fields Plugin](https://www.advancedcustomfields.com/)