Support » Fixing WordPress » Get/Print keys/values from specific meta_box (custom fields)

Viewing 3 replies - 1 through 3 (of 3 total)
  • lisa


    what end result are you looking for?
    are you using custom fields?
    which theme are you using?

    I am actually trying to filter posts based on their meta data. Again, I’ve been able to do this in the past, however the meta data was all in one file vs individual meta files as I listed above. I believe it is the individual functions within each meta file that are getting in the way because if I comment the functions out temporarily I am able to print and display the data in my filters. I am not sure if I need to call the functions somewhere else somehow or add to my filter query or how I go about that. See below for more details..

    Here is my filter code (how I’ve done it in the past) with the “print” included to test:

    <ul id="filters">
    		<li><span>Sort by:</span></li>
    	            $id = $_GET['directory_category'];
    	        <select id="sortCategory">
    	            <option value="" type="hidden">Category</option>
                        foreach($meta_box['fields'][4]['options'] as $directoryKey => $directoryValue)
                            <option value="<?php echo add_query_arg(array('directory_category' => $directoryKey)); ?>"><?php echo($directoryValue);?></option>

    And again, I think the function and/or callback is my culprit (top and bottom lines):

    add_action('add_meta_boxes', 'metabox_directory');
    function metabox_directory(){
    	$meta_box = array(
    		'id' => 'metabox-directory',
    		'title' => __('Custom settings for "Directory"'),
    		'description' => __('Fill in this listing\'s details below..'),
    		'post_type' => 'directory',
    		'context' => 'normal',
    		'priority' => 'high',
    		'fields' => array(
    					'name' => __('Header Image'),
    					'desc' => __('The image should be no less than 1400-2000px wide'),
    					'id' => 'header_bg',
    					'type' => 'file',
    					'std' => ''
    					'name' => __('Listing Address'),
    					'desc' => __('What is this listing\'s address?'),
    					'id' => 'directory_address',
    					'type' => 'text',
    					'std' => ''
    	$callback = create_function( '$post,$meta_box', 'create_meta_box( $post, $meta_box["args"] );' );
    	add_meta_box( $meta_box['id'], $meta_box['title'], $callback, $meta_box['post_type'], $meta_box['context'], $meta_box['priority'], $meta_box );

    Again, do I need to call the functions and callbacks elsewhere somehow maybe? Thanks again for all and any help!!

    Anybody? 🙁 I’m still bangin my head on my desk over here. Do I need to add an additional global call? Maybe something like “global $callback;”?

    Again, of course really appreciate all and any help. Thanks all!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get/Print keys/values from specific meta_box (custom fields)’ is closed to new replies.