• Resolved jedifunk

    (@jedifunk)


    hey all;

    i’m try to get the the post thumbnail (featured image) to provide its URL for use with Fancybox, so that on click, it loads the full size image in fancybox.

    i have read several different versions and can’t get any of them to fully work. here’s my code

    [Code moderated as per the Forum Rules. Please use the pastebin]

    any help is appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter jedifunk

    (@jedifunk)

    sorry, forgot about pastebin, here’s the code
    http://pastebin.com/mH8C0xpN

    it also stripped out some other info.

    i’m able to load the custom post type with the thumbnail, but its the on click to get fancybox to open the full size image that doesn’t work. it gives an error

    The requested content cannot be loaded.
    Please try again later.

    it also is showing this as the URL http://jbfj.local/<?php echo $url;?>

    thanks.

    jack randall

    (@theotherlebowski)

    fancybox hasn’t been updated since 2009 according to the page at wordpress.org/extend

    i’d look for another lightbox plugin, something like shadowbox js.

    Thread Starter jedifunk

    (@jedifunk)

    i’m not using the fancybox plugin, i’m just using its JS.

    i think the problem lies in that i’m trying to run php within php, but i don’t know enough about php to know for sure.

    jack randall

    (@theotherlebowski)

    that sounds like a really complicated way of doing things. just use a plugin and let it handle all the business logic, especially if you don’t know php! you could break your site if you tinker with the php

    Thread Starter jedifunk

    (@jedifunk)

    ok, so i figured it out on my own with a little tinkering. it isn’t complicated at all, and i’d rather use this instead of another bloated plugin.

    my assumption seems to have been correct. i think by trying to use the function inside an echo it was not possible. so i rejigged the php to remove the echo (i realized they weren’t necessary). thus producing cleaner code.

    i also moved the loop into its own php bracket and separated the thumbnail URL function from it. the end result is exactly what i was looking for.

    here’s my final code, hope it helps someone else out in the future.
    http://pastebin.com/ATDhLnwp

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: post-thumbnails] Post Thumbnail URL with Fancybox’ is closed to new replies.