• sledgedesign

    (@sledgedesign)


    I’ve resisted posting on here for a few days, but I’m having an issue with the to_image_src filter for which I cannot find a resolution to save my life.

    I’ve created a custom content type which contains a ‘img_photo’ custom field. The field is repeatable, so the client can upload/select as many photos as needed.

    I currently have a working for loop that will display the actual image, but I am having trouble just grabbing the source in order to create a link.

    Here is my loop that is displaying the photos:

    <?php
                                     $array_all_photos = get_custom_field('img_photo:to_array');
    
    			       foreach ($array_all_photos as $img_id) {  ?>
    
                       <a href="">
    				<? print CCTM::filter($img_id, 'to_image_tag');?>
                    </a>
                     <?php 	}   ?>

    I’ve tried so many methods for outputting the image src, I couldn’t tell you all of them. What seems most obvious is simply using
    <? print CCTM::filter($img_id, 'to_image_src');?> within the href=”” in the loop above, but that outputs no HTML at all.

    Do you have any suggestions? Thanks!

    http://wordpress.org/extend/plugins/custom-content-type-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • TC.K

    (@wp_dummy)

    Try this:

    `<?php
    $array_all_photos = get_custom_field(‘img_photo:to_array’, ‘to_image_src’);

    foreach ($array_of_photos as $img_id) {
    print “
    <li><a href='”.$img_id.”‘ /><img src='”.$img_id.”‘/></li>
    “;

    }
    ?>`

    Thread Starter sledgedesign

    (@sledgedesign)

    Unfortunately it did not work. It seems no matter how simple an expression I write, the “to_image_src” filter is not outputting anything. I can swap out the filter to “raw” and get a post ID, but that is as far as the forward progress seems to go.

    Any other thoughts on what might be causing the filter to not work?

    TC.K

    (@wp_dummy)

    Oh, I just found a typo on my script, it should be $array_all_photos at the foreach () function.

    The script should be like this :

    <?php
    $array_all_photos = get_custom_field('img_photo:to_array', 'to_image_src');
    
    foreach ($array_all_photos as $img_id) {
    print "
    <li><a href='".$img_id."' /><img src='".$img_id."'/></li>
    ";
    
    }
    ?>

    Hope this help

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Custom Content Type Manager] Issues with :to_image_src filter’ is closed to new replies.