Giter Site home page Giter Site logo

Comments (6)

hitty avatar hitty commented on May 20, 2024 2

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.

Log1x avatar Log1x commented on May 20, 2024

Is @field returning in plain text or nothing at all?

from sage-directives.

basvandertogt avatar basvandertogt commented on May 20, 2024

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.

Log1x avatar Log1x commented on May 20, 2024

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.

basvandertogt avatar basvandertogt commented on May 20, 2024

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.

blorange2 avatar blorange2 commented on May 20, 2024

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)

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.