Embeding custom fields into loop

Hi
I am a newb with custom fields and am just getting used to custom press.

I am at the stage where I would like to embed my custom fields. So I can see the php - <?php echo do_shortcode('[custom_fields_block]'); ?>

I know I need to put that in the page template within the loop.

Please help me out here - I want to embed it in the single post i.e. - this page - http://www.students4work.co.uk/vacancies/test-vacancy/

What file and line of the code do I insert the PHP?

Thanks for the support
Mark

  • markcronin007

    Hi Arnold

    Thank you for the BG info on the Wordpress Hierarchy very useful.

    So I have partly figured it out - see - http://www.students4work.co.uk/vacancies/test-vacancy/

    This is now using the new single-vacancies template.

    What I would like to do and am struggling - is to put the new php showing the custom fields block, below the post title. I have tried but no luck.

    Any ideas?
    Regards
    Mark

  • tfbc

    im looking to incorporate the fields directly into my template as well.
    I went under the custompress settings and generated the single-posttype.php files for all the custom post types that I created
    In this case I have
    Testimonials
    Adoptions
    Happy Tails as the 3 types I created

    then under custom fields I have created diff fields
    name
    age
    gender
    etc.

    and I selected that they only work with the adoption custom post type

    the single-adoption.php file looks like so

    <?php
    
    /**
    
     *
    
     * single.php
    
     *
    
     * The single post template. Used when a single post is queried.
    
     * 
    
     */
    
    get_header(); include get_template_directory()."/includes/tt_meta.php";  ?>
    
    			<?php  global $this_post_id; $this_post_id = $post->ID;top_widget_print('in'); 
    
    if ( theme_get_meta_option($post->ID, 'theme_show_home_widget') && !theme_get_meta_option($post->ID, 'theme_show_home_widget_pos')){home_page_widget($size);}
    
     ?>
    
     <?php 
    
    			if (have_posts()) {
    
    				/* Display navigation to next/previous posts when applicable */
    
    				if (theme_get_option('theme_top_single_navigation')) {
    
    					theme_page_navigation(
    
    							array(
    
    								'next_link' => theme_get_previous_post_link('&laquo; %link'),
    
    								'prev_link' => theme_get_next_post_link('%link &raquo;')
    
    							)
    
    					);
    
    				}
    
    				while (have_posts()) {
    
    					the_post();
    
    					get_template_part('content', 'single');
    
    					/* Display comments */
    
    					if (theme_get_option('theme_allow_comments')) {
    
    						comments_template();
    
    					}
    
    				}
    
    				/* Display navigation to next/previous posts when applicable */
    
    				if (theme_get_option('theme_bottom_single_navigation')) {
    
    					theme_page_navigation(
    
    							array(
    
    								'next_link' => theme_get_previous_post_link('&laquo; %link'),
    
    								'prev_link' => theme_get_next_post_link('%link &raquo;')
    
    							)
    
    					);
    
    				}
    
    			} else {
    
    				theme_404_content();
    
    			}
    
    			?>
    
    <?php if ( theme_get_meta_option($this_post_id, 'theme_show_sb_bot') && !theme_get_meta_option($this_post_id, 'theme_show_sb_bot_wide') ) {get_sidebar('bottom');} ?>
    
    <?php get_footer(); ?>

    I want the fields to echo directly below the content I enter into the editor window.

    when i tried the following the fields did echo but not within the theme box but below:

    the_post();
    
    					get_template_part('content', 'single');
    echo do_shortcode('[custom_fields_block]');
    					/* Display comments */
  • tfbc

    the content-single.php is as follows:

    <?php
    /**
     *
     * content*.php
     *
     * The post format template. You can change the structure of your posts or add/remove post elements here.
     *
     * 'id' - post id
     * 'class' - post class
     * 'thumbnail' - post icon
     * 'title' - post title
     * 'before' - post header metadata
     * 'content' - post content
     * 'after' - post footer metadata
     *
     * To create a new custom post format template you must create a file "content-YourTemplateName.php"
     * Then copy the contents of the existing content.php into your file and edit it the way you want.
     *
     * Change an existing get_template_part() function as follows:
     * get_template_part('content', 'YourTemplateName');
     *
     */
    global $post;
    theme_post_wrapper(
    		array(
    			'id' => theme_get_post_id(),
    			'class' => theme_get_post_class(),
    			'title' => theme_get_meta_option($post->ID, 'theme_show_post_title') ? get_the_title() : '',
    			'heading' => theme_get_option('theme_single_article_title_tag'),
    			'before' => theme_get_metadata_icons('date,author', 'header'),
    			'content' => theme_get_content(),
    			'after' => theme_get_metadata_icons('tag', 'footer')
    		)
    );
    
    	if( is_single() && (theme_get_meta_option( $post->ID, 'theme_show_author_box' )) ) {
    $author_block_style =  theme_get_meta_option( $post->ID, 'theme_show_author_box_style' );
    $author_block_style = 'theme_' . $author_block_style . '_wrapper';
    $author_block_style(
               array(
                    'title' => __('About ', THEME_NS).get_the_author_meta('nickname'),
                    'content' =>  theme_get_avatar(array('id' => get_the_author_meta( 'user_email' ), 'size' => 75)).get_the_author_meta( 'description' ) 		
    
    ) 	);
    
    }
    ?>

    how would i incorporate
    do_shortcode('[custom_fields_block]'); into this?
    it would have to be within:
    'content' => theme_get_content(),

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.