Comments (6)
For me too @field don't working, get_field working. But title, content and etc are working.
And also yarn docs:build ( docs:dev ) gives me 'Command not found'
from sage-directives.
Is @field
returning in plain text or nothing at all?
from sage-directives.
Not working: {{ get_field('config_button') }}
Working: {{ get_field('config_button', get_post()) }}
Not working: @field('config_button', get_post())
Not working: @field('config_button')
from sage-directives.
What is being rendered in the compiled Blade? You can find it in storage/framework/views
on Sage 10 or the uploads
folder (if I recall) on Sage 9.
https://github.com/Log1x/sage-directives/blob/master/src/Directives/ACF.php#L40-L62
The code is simple for the most part so it's hard to tell what could be messing up when Blade compiles.
from sage-directives.
I'm using Sage 9.
Compiled Blade:
So 1 is working 2,3 and 4 not.
<?php
$query = new WP_Query([
'post_type' => 'product'
]);
?>
<?php $posts = collect(); ?><?php if (is_a($query, 'WP_Post') || is_numeric($query)) : ?><?php $posts->put('p', is_a($query, 'WP_Post') ? ($query)->ID : $query); ?><?php endif; ?><?php if (is_array($query)) : ?><?php $posts
->put('ignore_sticky_posts', true)
->put('posts_per_page', -1)
->put('post__in', collect($query)
->map(function ($post) {
return is_a($post, 'WP_Post') ? $post->ID : $post;
})->all())
->put('orderby', 'post__in');
?><?php endif; ?><?php $query = $posts->isNotEmpty() ? new WP_Query($posts->all()) : $query; ?><?php if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post(); ?>
<article class="cell large-11 item">
1. <?php echo e(get_field('config_button', get_post())); ?>
2. <?php echo e(get_field('config_button')); ?>
3. <?= get_field('config_button')[get_post()]; ?>
4. <?= get_field('config_button'); ?>
</article>
<?php endwhile; wp_reset_postdata(); endif; ?>
from sage-directives.
Hi all, this still seems to be an issue.
I see in my rendered code it's because it does the following:
<?= get_field('introduction')[$post->ID]; ?>
When it should be:
<?php echo e(get_field("role", $post->ID)); ?>
Is there a fix for this, or is using {{}} the recommended fix?
Thanks
from sage-directives.
Related Issues (20)
- Installation, not working for me HOT 2
- Using ACF field name as parameter to @image directive - view not being recompiled when ACF field value is updated. HOT 2
- How to use blade loop variable? HOT 2
- @image directive with ACF field on archive partial not working HOT 1
- `@style` is already in use in Laravel Blade HOT 1
- Followed the docs but I get 'Command "docs:build" not found' HOT 4
- How to use directives within components/partials parameters? HOT 2
- Can't get this to work - Sage 9.0.10 HOT 2
- @hasfield render argument in wrong place HOT 1
- AFC Link Array Exception Illegal string offset 'title' HOT 1
- Access to Acorn container when Sage not active HOT 1
- Using @field with number as second parameter always returns the string case
- Add missing directive for dynamic sidebars
- Sage directives not working properly in Sage 9.0.9 install HOT 1
- Cannot use the attr parameter with the @thumbnail directive HOT 1
- @thumbnail fails when passing a WP_Post instance as the only parameter
- "Target class [blade.compiler] does not exist" after upgrading to Acorn v3 HOT 3
- Couldn't find a script named "docs:build". HOT 1
- Any plans to add @postmeta()?
- Should this work with Radicle? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sage-directives.