Support

Account

Forum Replies Created

  • How will anyone know what the field is for?
    The simple answer is, they don’t need to.
    Why? Because I know what it is for.

    For example, I have 1000 custom posts that all need a value.
    It is much easier to add this value on the front end. Otherwise I have to open, change and update each individual post in the back-end which would take forever.
    As I know what the field does, a title and long instruction field offer nothing but clutter.

    I’d even recommend down the line you add a filed_instructions/field_title = false to the array options.

    Thanks for the help, but for now, I’ve just removed them via css. I just don’t like loading stuff I don’t use.

  • Noticed today whilst upgrading to Pro that my dates are messed up as well.

    Worked fine yesterday via this…

    <?php
    $date = DateTime::createFromFormat('Ymd', get_field('movie_release_date'));
    echo $date->format('l j F Y');
    ?>

    …but today gives a fatal error.

  • This solves my question.

    <?php
    acf_form(array(
        'post_id'   => $post_id,
        'post_title'    => false,
        'field_groups' => array(21),
        'fields' => array('rating1','rating2'),
        'submit_value'  => 'Submit changes'
    ));
    ?>
  • Thanks John,

    I am using the pro version now but still unsure how to show only two fields named ‘rating1’ and ‘rating2’ in my front-end form (from a field group with ID of 21). At the moment I am seeing every field. Any thoughts on how I can show ONLY these 2 fields? My code so far…

    acf_form(array(
        'post_id'   => $post_id,
        'post_title'    => false,
        'field_groups' => array(21),
        'submit_value'  => 'Submit changes'
    ));
  • Thank you so much James. We have been trying to work this one out for a while and you have managed to to nail the answer perfectly!

  • I also noticed that this stopped working completely. Unlike Futaba, it still does not seem to be working for me. Was great for months then one day out of nowhere, failed.
    No idea why to this day so we had to disable the feature completely unfortunately. I always assumed it was something Google changed on their end as our site and code didn’t change at all.

  • Thanks James. It didn’t make sense 2 hours ago, but looks to be clearer now. I have it working at last using some tweaked code from your link.

  • Hi @andisaleh

    That did the trick! get_the_title() was the problem.
    I cannot thank you enough – this has consumed days of my life this week, and I am very appreciative.

    thanks to everyone else who offered asssitance.

  • Hi @andisaleh and @elliot

    I feel this is getting closer but still can’t work out why such a simple task of grabbing one value from another post and matching it to current post is so hard. I am going crazy! haha.

    New query is now this, but unfortunately it returns nothing.

    <?php
    $args = array(
      'numberposts'=> -1,           // Fetch all posts...
      'post_type'=> 'release',      // from the 'release' CPT...
      'meta_key' => 'artist_name', // which inside this meta key...
      'meta_value' => get_the_ID(),   // has this meta value.
    );
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) :
      echo '<ul>';
      while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <li>
    <img src="<?php the_field('cover_image'); ?>" />
    <?php the_field('artist_name'); ?>
    <?php the_title(); ?>
    </li>
    
    <?php 
    endwhile; echo '</ul>';
    endif; wp_reset_query(); ?>

    Failing this – do either of you know any quick places I can go to pay someone to do this? I just don’t have any contacts in that regard.

  • Hi @andisaleh

    Thanks for the explanation, but that now outputs ALL of the releases. Which makes it no different to my original post/query which outputs everything.

    How do I get it to recognize what artist page i am on and then ONLY output releases from that artists. Right now it is just bringing in every release from every artist on every page.

    Does that make sense?

  • Hi @elliot
    Again, I appreciate the response, but I just don’t see how this helps what I am trying to do. I must have read that page you keep link to 30 times and don’t see how it is relevant.
    I shall chalk this one down to me being stupid and hope someone else can offer some more in depth assistance.
    I just have always assumed this to be a really common use of custom post types, but starting to feel it is beyond things here.

    Thanks again.

  • Hi @andisaleh
    Using your code I can now output the artist title on the page, but it does nothing to bring the releases in. Any thoughts?

  • Hi @andisaleh

    Thanks for your reply, but I am still really struggling with this. Not sure where that code you provided should go. Where would it fit in relation to my full query/code here…

    <?php
         $args=array(
         'post_type' => 'book',
         'post_status' => 'publish',
         'posts_per_page' => 12,
         'caller_get_posts'=> 1,
         'orderby'=> 'date',
         'order' => 'DESC'
         );
         $my_query = null;
         $my_query = new WP_Query($args);
         if( $my_query->have_posts() ) {
         echo '';
         $i = 0;
         while ($my_query->have_posts()) : $my_query->the_post();
         if($i % 6 == 0) { ?>
    <div class="row">    
    <?php
    }
    ?>
    
    <img src="<?php the_field('cover_image'); ?>" /><br />
    <?php the_field('author_name'); ?><br />
    <?php the_title(); ?><br />
    
    </div>
    
    <?php    
    if($i % 6 == 0) { ?> 
    
    <?php
    }
    
    $i++;
    endwhile;
     } 
    wp_reset_query();
    ?>

    Any help appreciated.

  • This is the code I use to display ALL of the releases. It works great.

    I need to somehow adapt this query to show only the Releases of a specific artist on their Artist page. Thought it might help…

    <?php
         $args=array(
         'post_type' => 'book',
         'post_status' => 'publish',
         'posts_per_page' => 12,
         'caller_get_posts'=> 1,
         'orderby'=> 'date',
         'order' => 'DESC'
         );
         $my_query = null;
         $my_query = new WP_Query($args);
         if( $my_query->have_posts() ) {
         echo '';
         $i = 0;
         while ($my_query->have_posts()) : $my_query->the_post();
         if($i % 6 == 0) { ?>
    <div class="row">    
    <?php
    }
    ?>
    
    <img src="<?php the_field('cover_image'); ?>" /><br />
    <?php the_field('author_name'); ?><br />
    <?php the_title(); ?><br />
    
    </div>
    
    <?php    
    if($i % 6 == 0) { ?> 
    
    <?php
    }
    
    $i++;
    endwhile;
     } 
    wp_reset_query();
    ?>
  • Thanks @elliot but still struggling with this all day again.

    I think I am way off track here and am now even more confused.

    Do I need to link the posts in any way whatsoever? Do I need to add any sort of custom filed to the ARTIST page to link it to RELEASES?

    I am positive this will take 5 lines of code, but it has become so complicated. Is what I am doing at all unusual or am not explaining it well enough?

    Maybe another approach using books.

    Two custom post types…

    BOOK.
    BOOK AUTHOR.

    ARCHIVE PAGEs for both BOOK and BOOK AUTHOR exist.

    I want to…

    LIST BOOK on BOOK AUTHOR PAGE. Simple right?

    So if i have 10 books by Stephen KING. I want to list them all (and only those by him) on the STEPHEN KING page.

  • Hi @elliot

    I still don’t really follow how that will work. In the example, that requires you put in a key value of ‘Melbourne’. That is great if you only have one value called ‘Melbourne’, but I have 30 different artists.

    How can I tell which artist page I am currently on before I show the value for that particular artist without setting up 30 different templates?

    Does that make sense?

    If I am on the Metallica page, I ONLY want to show Metallica releases. With 30 artists, do I need to set up 30 templates to call the specific artist value on each one?

  • I feel like I am over-complicating things as I don’t understand your post, though thankful for you trying!

    How about this…

    CUSTOM POST TYPE: RELEASE
    VALUES: Album cover art, Album title, Album Artist, Album track listing

    How do I display ALL of the releases by one artist.

    So on my ARTIST page for Metallica, I would have their 10 albums.
    On my artist page for Coldplay, I would have their 5 albums etc.

    I don’t understand how to link a RELEASE to an ARTIST and then show only those RELEASES for any given ARTIST.

  • As usual, it was a typo by me in the code calling the wrong custom field!
    Thanks for your help though.

  • We have a winner! thanks very much for the help. Final working code here for those in the future…

    <?php
    $cat = get_field(‘artist_news’);
    $recentposts=get_posts(‘showposts=3&category=’ . $cat);
    if ($recentposts) {
    foreach($recentposts as $post) {
    setup_postdata($post);
    ?>

  • So does this repalce ALL of my above code or do I integrate it somehow with mine?

    When I replace it with your code I get an error…

    fatal error: Call to undefined function get_the_field()

Viewing 21 posts - 1 through 21 (of 21 total)