0

I am using Magic Fields for custom fields. I am not able to retrieve data from my post type.

I have this fields inside my post type:

fields

Now I have Page and Page template is releases.php

Inside releases.php i have this code:

<div class="main_6">
  <div class="pargraph">
    <?php if(have_posts()): while(have_posts()) : the_post(); ?>
    <?php
        $data = get_group('Releases');
        print_r($data);
    ?>
    <?php endwhile; endif; ?>
  </div>
</div>

You can I am trying to print_r($data) but nothing display from my page. I also refer this document but not worked for me. http://wiki.magicfields.org/doku.php?id=dealing_with_groups_duplicate_groups_and_duplicate_fields

1 Answer 1

0

EDIT: (Just had another look at the documentation, and noticed the following)

If you look at the code below, you'll notice that you're doing it differently. They are calling the field from within a group.

$miembros = get_group('miembro');
  // to see how this made the arrangement can use pr($miembros);
  // the way this arrangement is made
  // [index of the group] [field name] [index of the field]
  // for fields image type level but in accordance with the letter "o" to the original image or "t" for thumbnail
  foreach($miembros as $miembro){
    echo $miembro['nombre_miembro'][1]."<br />";
    echo $miembro['puesto_miembro'][1]."<br />";
    echo "<img src='".$miembro['foto_miembro'][1]['t']."'><br /><br />";
  }

So, what you need to do it put the Released field into it's own group (as an example, let's call it group1), and then do the following:

$group = get_group('group1');
 foreach($groups $group){
    echo $group['released'][1];
}

The function needs you to specify the individual fields before calling them, so that you ca choose which ones to do.

(Side note: If you continue to have troubles with this plugin, I would recommend trying out Advanced Custom Fields instead, as the user interface and the code for showing field content in templates is a lot easier to understand.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.