Editing the post page layout – custom fields

Hi I have added some custom fields to this page – http://www.students4work.co.uk/vacancies/test-vacancy/

I now want to edit the php so the page title is displayed above them, this may be more or a genral question – but how do I edit my template to achieve this?

Many thanks

Mark

  • markcronin007
    • Site Builder, Child of Zeus

    Hi yes I have created single-vacancies.php

    <?php get_header() ?>

    <div id=”content”><!– start #content –>

    <div class=”padder”>

    <?php if($bp_existed == ‘true’:wink: : ?>

    <?php do_action( ‘bp_before_blog_single_post’ ) ?>

    <?php endif; ?>

    <div class=”page” id=”blog-single”><!– start #blog-single –>

    <?php if (have_posts()) : ?>

    <?php if( $bp_existed == ‘true’ ) { ?>

    <?php bp_wpmu_singleloop(); ?>

    <?php } else { ?>

    <?php echo do_shortcode(‘[custom_fields_block]‘:wink:; ?>

    <?php wpmu_singleloop(); ?>

    <?php } ?>

    <?php locate_template( array( ‘/library/components/pagination.php’ ), true ); ?>

    <?php else: ?>

    <?php locate_template( array( ‘/library/components/messages.php’ ), true ); ?>

    <?php endif; ?>

    </div><!– end #blog-single –>

    <?php if($bp_existed == ‘true’:wink: : ?>

    <?php do_action( ‘bp_after_blog_single_post’ ) ?>

    <?php endif; ?>

    </div>

    </div><!– end #content –>

    <?php get_sidebar(‘single’:wink:; ?>

    <?php get_footer() ?>

    I also want to edit the post/blog summary page – which page template is this page using? – http://www.students4work.co.uk/vacancies/

    Many thanks

    Mark

  • markcronin007
    • Site Builder, Child of Zeus

    Hi Tomothy

    No I am not an expert with PHP and I am just learning about all the stuff I can do with the WordPress loop etc – (Reading the WordPress Bible right now! – http://www.amazon.co.uk/WordPress-Bible-ebook/dp/B004SQS6W6/ref=sr_1_1?ie=UTF8&qid=1351965126&sr=8-1 )

    What I did was take the existing single.php page template and pop in the php code created by the CustomPress plugin, then re-named it to pick up vacancies.


    So the help I need is – I have tried putting the PHP include for the CustomPress fields in the loop on the template. I have tried putting it in different places etc .But it seems to sit above the post right now.

    What I want to achieve is that the CustomPress fields are show below the Post title.. So

    POST TITLE

    CUSTOMPRESS FIELDS

    CONTENT AREA

    Hope this makes more sense. Don’t worry about the other page thing.

    This is my main issue.

    Regards

    Mark

    At the

  • Timothy
    • Chief Pigeon

    Hey again.

    So with single site the loop is coming from this function wpmu_singleloop(), which theme of ours are you using, is this Network?

    If it where then the file the loop comes from is here:

    /network/library/functions/loop-functions.php

    You will find the function and loop in there.

    Take care.

  • Timothy
    • Chief Pigeon

    Sorry I cut that short. That then takes you to wpmu_single_loop():

    function wpmu_single_loop(){
    rewind_posts();
    while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="post-content-wp">
    <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'network' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="date"><span class="byline"><?php the_time('M j Y') ?> <?php _e( 'in', 'network' ) ?> <?php the_category(', ') ?> <em><?php _e( 'by ', 'network' ) ?><?php the_author_link(); ?></em></span></p>
    <div class="entry">
    <?php the_content(); ?>
    </div>
    <p class="postmetadata"><span class="tags"><?php the_tags( __( 'Tags: ', 'network' ), ', ', '<br />'); ?></span> <span class="comments"><?php comments_popup_link( __( 'No Comments »', 'network' ), __( '1 Comment »', 'network' ), __( '% Comments »', 'network' ) ); ?></span></p>
    </div>
    </div>

    <?php comments_template('', true);
    ?>
    <?php endwhile;

    }

    The title part is:

    <h2 class="posttitle"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'network' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

    Take care.

  • Timothy
    • Chief Pigeon

    Ah but then the fileds will display for every type of post ?

    That is correct but…. You can do something like this:

    if ( get_post_type() == 'vacancies') {
    DO THE CUSTOM FIELD STUFF
    }

    That way the code will only be executed for the custom post type of vacancies.

    I presume with you asking this you found the function in Studio? Or do you still need some guidance there?

    Take care.

  • markcronin007
    • Site Builder, Child of Zeus

    Hi Timothy

    Thanks for the file location.

    So I put the PHP to call/show the custom fileds just before the content in the file you mention – but It doesn’t show see – http://www.students4work.co.uk/vacancies/waiter-needed/

    function bp_wpmu_single_loop(){
    rewind_posts();
    while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <div class="author-box">
    <?php echo get_avatar( get_the_author_meta( 'user_email' ), '50' ); ?>
    <p><?php _e( 'by ', 'studio' ) ?><?php the_author_link(); ?></p>
    </div>
    <div class="post-content">
    <h2 class="posttitle"><a>" rel="bookmark" title="<?php _e( 'Permanent Link to', 'studio' ) ?> <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    <p class="date"><?php the_time('M j Y') ?> <em><?php _e( 'in', 'studio' ) ?> <?php the_category(', ') ?> <?php _e( 'by ', 'studio' ) ?><?php the_author_link(); ?></em></p>

    <div class="entry">
    <?php echo do_shortcode('[custom_fields_block]'); ?>
    <?php the_content( __( 'Read the rest of this entry ?', 'studio' ) ); ?>
    </div>

    Thank you for your ongoing help, it is appreciated.

    Regards

    Mark

  • markcronin007
    • Site Builder, Child of Zeus

    Hi

    It is not an example code – the wording seems to indicate it is the generic code that can be used to embed the entire custom block rather than each field at a time?

    Here is the wording copied from the plugin-

    Embedding Custom Fields

    Embed codes are used in templates to return the value of the custom fields of the current post. Codes may be for individual fields using the Embed code links below for each field

    or you can display the entire block of custom fields for a listing using the embed code:

    <?php echo do_shortcode(‘[custom_fields_block]‘:wink:; ?>

    I will try the induvidual codes and see how I get on.

  • Timothy
    • Chief Pigeon

    It is not an example code – the wording seems to indicate it is the generic code that can be used to embed the entire custom block rather than each field at a time?

    Nope you’re correct, for some reason I thought you were using an example one.

    I noted from your account that the last version you downloaded was 1.2.4.1, we’re now on 1.3.0.5. Could you please upgrade and then try again.

    Let me know how that goes.

    Thanks.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.