WordPress.org

Ready to get started?Download WordPress

Forums

Custom field data in php statement (6 posts)

  1. 2bak860
    Member
    Posted 4 years ago #

    Hi,

    I'm trying to get a custom field data to display in a php statement.

    I'm using flickr rss and I want the part in bold to be the content of a custom field - any ideas?

    <?php get_flickrRSS(array('set' => '72157601681097311', 'num_items' => 6, 'type' => 'set', 'id' => '30735063@N03')); ?>

    thanks, Ross

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

  3. 2bak860
    Member
    Posted 4 years ago #

    Thanks t31os_. How do I use the custom field value in my php?

    <?php get_flickrRSS(array('set' => 'custom_field_value', 'num_items' => 6, 'type' => 'set', 'id' => '30735063@N03')); ?>

    thanks, Ross

  4. Mark / t31os
    Moderator
    Posted 4 years ago #

    Which post do you want to get the meta data from? and what's the name of the custom field you want data from?

  5. 2bak860
    Member
    Posted 4 years ago #

    Hi t31os_.

    The post is the current post and the custom field is: flickr_gallery

    many thanks, Ross

  6. Mark / t31os
    Moderator
    Posted 4 years ago #

    I'd imagine you want something like this then..

    <?php
    // Get post meta data
    $custom_field = get_post_meta( $post->ID , 'flickr_gallery' , true );
    
    // Check if we have data
    if( $custom_field ) {
    
    	// We have data, do the thingy
    	get_flickrRSS( array( 'set' => $custom_field , 'num_items' => 6 , 'type' => 'set' , 'id' => '30735063@N03' ) );
    
    }
    // End if
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.