Use the 'custom field' code in templates
-
Hi,
I am using Arras 1431 with WP3.
On my posts I include a custom field called ‘price’
I now want to play with my code, so every post will automatically display the custom field ‘price’
1/ So, what is the generated code for the custom field ‘price’ and how would I then change my template?
As a working example, I want to change two things:
2/ I want to change number of comments <?php comments_number() ? to ‘Price: € 99’
<div class=”entry-info”>
<abbr class=”published” title=”<?php the_time(‘c’) ?>”><?php printf( __(‘Posted on %s’, ‘arras’), get_the_time(get_option(‘date_format’)) ) ?></abbr> | <span><?php comments_number() ?>
</span>
</div>3/ I also want to change the get_the_time to the first two words of the page title, any ideas how to implement that, using,
get_the_title combined with below code adjusted for title instead of excerpt:// Changing excerpt length
function new_excerpt_length($length) {
return 40;
}
add_filter(‘excerpt_length’, ‘new_excerpt_length’);Thanks for any input!
Andy
- The topic ‘Use the 'custom field' code in templates’ is closed to new replies.