Support

Account

Forum Replies Created

  • I was able to solve my own question – not entirely sure why, as i’m in the loop but by adding the explicit $post-ID to the_field call. IE:

    <?php the_field('location_color', $post->ID); ?>

    I was able to access the fields. If anyone has the explanation for why that is, i’d be curious to hear it. But there’s the solution regardless.

  • @beee – I posted my own question here – because my previous post was in a response to someone else’s question I wasn’t expecting to get an answer there, however it was followed up on. So this post became redundant.

    However i’m leaving it in place in case anyone has the same question and is looking for a solution.

  • @beee – I believe that’s what I was attempting to do. If you go here:
    https://support.advancedcustomfields.com/forums/topic/display-custom-field-value-on-edit-page/

    and follow the thread to the bottom of the page. I didn’t use acf/save but rather acf/render_field and php sessions. There’s a screenshot of the final product. let me know what you think.

  • Thanks John – I figured something out.

    I wrote this function:

    
    function generate_acf_shortcode( $field ) {
     echo '<pre>[post-snippet post="'; print_r($field['value']); echo '"]</pre>';
    }
    
    add_action( 'acf/render_field/type=page_link', 'generate_acf_shortcode', 10, 1 );
    

    This generated the proper snippet syntax (actual short code i wrote elsewhere) inline with my page_link fields.

    I followed that up by altering it to this:

    
    function generate_acf_shortcode( $field ) {
      $_SESSION['acf_post_link'] = $field['value'];
    }
    
    add_action( 'acf/render_field/type=page_link', 'generate_acf_shortcode', 10, 1 );
    

    and then in the EMF field I called this to pull those values in for each field:

    
    [post-snippet post="<?php echo $_SESSION['acf_post_link']; ?>"]
    

    Ended up With this:

  • Fantastic. That was easy enough – thanks John, feeling my way through these hooks. One more question – I’ve been exploring the enhanced message field plugin you’d mentioned above, there’s not much by way of documentation on it and I’m thinking it’d be great to do similar to what i posted above – but instead of inlining the field output below or above the field, to display it in an enhanced message field next to the field. (eg. selector field | enhanced message field with selector field output)

    Is there away to write that for the EMF?

  • to clarify – the output I’m looking for would be used to specify to the user a shortcode id. So user selects a specific post from the dropdown (lets say “post title example”, and this post has an ID of 7 -> user saves -> text below field populates saying [post_embed id=”7″]

    (I have the custom shortcode written)

  • Hi Guys –

    John thanks or helping Byrant out with his issue – I have a similar question but I can’t quite make the leap from the above example to mine. Essentially what I need to do is display custom text below a given sub field (it’s a page_link field) that get’s the ID of the selected page_link field, and displays it.

    I’ve been able to render text below the select field fine, but when I echo the field value, it’s just echoing the ID for the current page, not the page_link field.

    Any help would be greatly appreciated.

  • Jumping in on this thread to add that i’ve run into the same issue with YARPP and an ACF image gallery field. When I pull the field anywhere else on my site it returns fine, when i pull the same into a YARPP template, I get an error. Printing the array elsewhere, i get the full image set array (paths, ids, etc.) when i pull it via YARPP, it only returns image ids. Very strange – has anyone had any luck with this the issue?

  • Adding onto this thread – similar use case, repeater fields with nested repeaters options and TinyMCE as a page/content builder. DB queries are through the roof even with db caching and transients enabled. There’s just no getting around it.

    ACF is an indispensable WP tool i’ve built dozens of sites with it and consider it one of the finest crafted plugins i’ve ever used. However, this need to be addressed and fixed asap – it critically limits it’s usefulness at best, and at worst can result in a crippled website.

    If I can help with that process in anyway let me know please.

  • So i believe i’ve sourced the issue to the theme loading in “Mr Meta Box” functionality, I haven’t gone further, but i wouldn’t doubt if there was a conflict specifically with Mr Meta Box’s Geolocation function here:

    https://github.com/mrfoto/mr-meta-box/blob/master/js/geocomplete.js

    If you have a moment, have a look at that and let me know if you think that makes sense. I know that if i disable Mr Meta, the ACF maps function returns, so i’m definitely in the right place.

  • That’s correct – I tested with stock 2016 and it worked fine, and i tested with the latest stock Port theme, and it wasn’t working. So it’s definitely on them. Thanks for the suggestions, i’ll post back here once i source the issue.

  • No help from Themetrust – they just simply said the issue is with ACF. I’m not inclined to believe that.

  • That’s my assumption as well – I loaded an entirely fresh install of the base theme and tested, the errors persisted. I have a request in now with the theme developer (Themetrust – theme is Port, for anyone watching at home.)

    This is why I prefer to build themes from scratch… trying to find an obscure incompatibility in a premium theme is wretched.

    Thanks for your time – i’ll report back if a fix is forthcoming, might be interesting.

  • It does appear to be theme related, not plugin related. Very strange though that nothing had changed with the previous theme except the WordPress Version. No template changes or plugin changes for that matter. Would that suggest an incompatibility with the theme and the latest version of WordPress?

  • Ah. Fixed the issue by switching the field from post_ID to post object.

  • Bumping this – have the same issue.
    I get the featured image, title and other acf fields, but no excerpt or content.

    <h3>Course Faculty</h3>
    
               <?php
               global $post;
               $faculty = get_field('alt_faculty');
               if( $faculty ): ?>
               <?php foreach( $faculty as $post): ?>
                <?php setup_postdata($post); ?>
    
                <div class="post-author">
                  <div class="thumb">
                    <?php if ( has_post_thumbnail() ) { ?>
                    <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
                    <?php } else { ?>
                    <a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" /></a><?php }?>
                  </div>
                  <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
                  <?php the_excerpt(); ?>
                  <?php get_template_part( 'partials/profile-social', '' ); ?>
                </div>
    
              <?php endforeach; ?>
              <?php wp_reset_postdata(); ?>
    
            <?php endif; ?>
    
  • likewise much thanks – i never reported back, it worked great, my results are here: http://www.richarderdman.com/collections-map/

  • hmm. I may have solved the issue – tell me if this makes sense, i changed the $posts var to $authors and that seems to solved the conflict, must be $posts is used already?

  • It’s very simple standard search.php – i’m fairly certain it isn’t templating related but have a look – it’s built off of Bones WP :

    
    <?php get_header('search'); ?>
    
    <div id="content">
    
      <div id="inner-content" class="wrap cf">
    
        <main id="main" class="cf" role="main" itemscope itemprop="mainContentOfPage" itemtype="http://schema.org/Blog">
          <!-- USER PANELS -->
    
          <article class="cf" role="article" itemscope itemtype="http://schema.org/BlogPosting">
    
            <section class="middlecontent cf" itemprop="articleBody">
            <h3>Results:</h3>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
              <?php
    
              $posts = get_field('author_selector');
    
              if( $posts ): ?>
    
                  <?php foreach( $posts as $post): // variable must be called $post (IMPORTANT) ?>
                      <?php setup_postdata($post); ?>
    
                          <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    
                  <?php endforeach; ?>
    
                  <?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
              <?php endif; ?>
    
              <figure class="effect-marley m-all t-1of3 d-1of3">
    
              <div class="thumbwrap">
               <?php if ( get_the_post_thumbnail($post_id) != '' ) {
    
                echo '<a href="'; the_permalink(); echo '" class="thumbnail-wrapper">';
                 the_post_thumbnail('sterling-largethumb');
                echo '</a>';
    
              } else {
    
               echo '<a href="'; the_permalink(); echo '" class="thumbnail-wrapper">';
               echo '<div class="fillthumb" style="background-image:url(';
               echo catch_that_image();
               echo ');"></div>';
               echo '</a>';
    
              } ?>
              </div>
               <figcaption>
                <h2><?php the_title(); ?></h2>
                <p><?php the_excerpt(); ?></p>
                <a href="<?php the_permalink(); ?>">View more</a>
              </figcaption>
              </figure>
    
              <?php endwhile; ?>
    
              <?php wpex_pagination(); ?>
    
            <?php else : ?>
    
            <?php endif; ?>
    
          </section>
        </article>
    
      </main>
    
    </div>
    
    </div>
    
    <?php get_template_part( 'partials/socialmedia', '' ); ?>
    
    <?php get_footer(); ?>
    
  • Wow. There it is. I was really stumped and it’s just a simple CSS img width bug. Thanks so much!

  • To give some further info on my issue:

    The same functionality working on the live site http://www.richarderdman.com/collections-map/

    The same functionality (minus the multiple locations, but calls the same acf js) with map bg NOT working (but note, marker functionality works fine still.)

    http://www.richarderdman.com/sculpture/grande-eleos/
    scroll down to “Sculpture Location”

  • This is great – thanks so much for the help. I was able to get things working with this assist!

  • I’ve got it!

    Instead of running another full query – I just ran a local foreach.

    
    <ul class="package">
      <?php
    
        $args = array(
        'post_type' => 'page', 
        'meta_query' => array(array(
          'key' => 'package-creator',
          'value' => '"' . get_the_ID() . '"',
          'compare' => 'LIKE'
          )
        ));
      
      $getmysiblings = new WP_Query($args) ?>
      <?php if ($getmysiblings->have_posts()): ?>
      <?php while ($getmysiblings-> have_posts()): $getmysiblings->the_post(); ?>
        <?php // get the relationship field ?>    
        <?php 
         $siblings = get_field('package-creator');
            foreach($siblings as $sibling) {
             $sibling_name = $sibling->post_title; ?>
            
             <li><a href="<?php echo post_permalink($sibling); ?>"><?php echo $sibling_name; ?></a></li>
             
        <?php } ?>
    
        <?php // end get relationship field ?>
      <?php endwhile; ?>
      <?php wp_reset_postdata(); ?>
      <?php else: ?>
      <?php endif; ?>
    </ul> 
    
  • I rebuilt the query using get_posts entirely and still no love – again the query seems to be corrupting the main $posts. Might open up a ticket with Elliot.

  • It almost makes me think that I need to find an alternative for pulling the relationship field that doesn’t use another loop.

Viewing 25 posts - 1 through 25 (of 37 total)