• Resolved crossbeats

    (@crossbeats)


    I’m struggling to integrate this lightbox with WP-Types. I’m able to display a text link, which opens the image in the lightbox, but can’t for the life of me get the IMAGE to display and link to the larger image.

    This is the WP-Type code I’m using to display the image, and wrap the image in the link to the larger image:

    <a href="<?php echo ($image1);?>"> <?php echo types_render_field( "image-1", array( "height" => "300", "proportional" => "true", "class" => "secondary-image" ) ); ?></a>

    I put that in the slb_activate code:

    <?php $content = "<a href='$image1'> <?php echo types_render_field( 'image-1', array( 'height' => '300', 'proportional' => 'true', 'class' => 'secondary-image' ) ); ?></a>";?>
    <?php if ( function_exists('slb_activate') ) ?>
    <?php $content = slb_activate($content); ?>
    <?php echo $content; ?>

    And this is what shows up

    It links to the image, in the lightbox just fine.

    I tried removing all of that information in the array, and JUST including the WP-Types code for the image:

    <?php $content = "<a href='$image1'> <?php echo types_render_field( 'image-1'); ?></a>";?>
    <?php if ( function_exists('slb_activate') ) ?>
    <?php $content = slb_activate($content); ?>
    <?php echo $content; ?>

    And nothing shows up at ALL. So I need some way to put the WP-Types code through the slb_activate code intact, to display the image.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Archetyped

    (@archetyped)

    When you use echo the data is output directly to the browser, rather than being saved to the $content variable. You’re also opening a new PHP tag without closing another (on the first line), which is invalid and will cause issues.

    I don’t use WP Types and am not familiar with types_render_field(), but here is a simplified version of your code that should work:

    <?php
    $content = "<a href='$image1'>" . types_render_field( 'image-1') . "</a>";
    if ( function_exists('slb_activate') ) {
    	$content = slb_activate($content);
    }
    echo $content;
    ?>
    Thread Starter crossbeats

    (@crossbeats)

    Thank you so much! Worked like a charm. Awesome plugin, and I very much appreciate your responsiveness.

    Plugin Author Archetyped

    (@archetyped)

    Glad to hear it worked ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Integrating with WP-Types/Custom Fields’ is closed to new replies.