Custom Field Suite

One warning. If you plan to use WPML, do not use the Custom Field Suite plugin. It has problem copying the fields to the translated pages. Use Types instead.

How to create an image gallery using Custom Field Suite

First, in your dashboard, go to Field Groups and press Add New.

Name it, eg. Image Gallery.

Press Add New Field. In title add eg. Images. In Field Type add Loop.

Press Add New Field again. In title add eg. Image. In Field Type add File Upload.

Press Update, and using drag-and-drop reparent the image field.

Now, in your php page template use the code below.

$images = CFS()->get('images');
foreach ($images as $img) {
    echo '<img src="' . $img['image'] . '">';

To get the images outside of the loop, then we need the page or post or even product ID:

$images = CFS()->get('images', $product_id);

Nested loops

$group_of_images = CFS()->get('group_of_images');
foreach ($group_of_images as $group_of_image) {
    $images = $group_of_image['images'];
    foreach ($images as $img) {
        echo '<img src=' . $img['image'] . '">';

How to filter your posts that contain custom fields

$args = array(
    'posts_per_page' => -1,
    'post_type' => 'author',
    'meta_key' => 'author_age',
    'meta_value' => '30'
$theposts = get_posts($args);
foreach ($theposts as $post) :

WPML and custom field suite

$greek_id = icl_object_id(get_the_ID(), 'product', false, 'el');
$pdf = CFS()->get('pdf', $greek_term_id);

Learning Resources

  • The original documentation here.
  • naeem
    Posted at 07:46, 21 AprilReply

    nested inner loop is not working for me. outer loop work inner loop give error in valid arrguments.

    • Website tutorials
      Posted at 08:18, 21 AprilReply

      Exact error? Are you using the latest version of custom field suite?

Post A Comment

Anti-Spam Quiz: