• Note: I’m sixteen and know almost nothing about PHP, other than the fact that it scares me.

    I’m trying to implement a featured post carousel like the one described here. However, it immediately crashes the entire site.

    I isolated the problem by building the carousel step by step. I am able to retrieve and list the posts just fine. I can retrieve basic data about each post (title, id, permalink, etc.). Everything displays properly and where I want it to. Until I try to retrieve the custom values. Doing so crashes everything. I can’t even print the values.

    Here’s the relevant code (This obviously isn’t a carousel, just what I’ve determined the problem to be.):

    <?php $featured_posts = get_posts('numberposts=3&category=60&orderby=rand');
    		foreach( $featured_posts as $post ) {
    			print get_post_custom_values('featured_image',?$post->ID);
    		}
    		?>

    Using get_post_custom_values breaks the whole site. If I can just figure out how to get the custom values, I’ll be able to build the carousel just fine. I think it might have something to do with the fact that I’m outside the Loop, but as far as I can tell, the tutorial example (which uses Kubrick) operates outside the Loop as well. But I could very easily be wrong. I’m beyond inexperienced with this stuff.

    By the way, I’m using the Thematic framework.

    I wish I could include a link to my site, but right now it is installed locally with MAMP. So, obviously, that wouldn’t work.

    Thanks in advance to anybody who can help. I’ve spent a week on this and it has frustrated the hell out of my small brain, haha.

  • The topic ‘Retrieving custom fields for “carousel” outside loop’ is closed to new replies.