• Hello,
    I am trying to make nivo slider to work with Page custom field.I did manage to make it work with Post custom field, but when I use custom field from pages nothing happens.
    Here is the code I am using:

    <?php
    		$postcount = 0;
            $featured_query = new WP_Query('showposts=1000');
            while ($featured_query->have_posts()) : $featured_query->the_post();
    
            $do_not_duplicate[] = get_the_ID();
            $postcount++;
            ?>	
    
            <?php
            // get the image filename
            $value_feat_img = get_post_custom_values("Image");
    
            if (isset($value_feat_img[0])) { ?>
    
            <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>" title="<?php the_title(); ?>" alt="<?php the_title(); ?>" />
            </a>
    
            <?php } ?>
    
    		<?php endwhile; ?>

    Do I need to modify something so the custom field from pages work ?
    I am new to PHP so it’s hard for me to make it work.

Viewing 2 replies - 1 through 2 (of 2 total)
  • mmm… not sure, your code should work fine, try adding the post id to the get_post_custom_values() function like this $value_feat_img = get_post_custom_values("Image", $post->ID );

    Thread Starter diabeticdiet

    (@diabeticdiet)

    try adding the post id to the get_post_custom_values() function like this $value_feat_img = get_post_custom_values("Image", $post->ID );

    nop, no changes.
    I am more lost now after you confirmed that the code is good.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Nivo Slider and custom fields’ is closed to new replies.