Plugin: Types
URL: https://wordpress.org/plugins/types/
Custom Post Type:
Custom Fields:
archive-varebiler.php:
<?php if(have_posts()): query_posts('post_type=varebiler&orderby=title&order=ASC&posts_per_page=-1'); while(have_posts()): the_post(); ?> <div class="col-md-4 col-sm-6 col-xs-12"> <div class="archivePost"> <h2 class="entry-title"><?php the_title(); ?></h2> <a href="<?php the_permalink(); ?>"><?php echo "".types_render_field("varebil-data-billede", array("size"=>"featured-varebiler","output"=>"HTML")); ?></a> <p><a href="<?php the_permalink(); ?>"><div class="archiveButton">Læs mere</div></a></p> </div><!-- .archivePost --> </div><!-- .col --> <?php endwhile; endif; ?>
single-varebiler.php:
<?php while ( have_posts() ) : the_post(); ?> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <h1 class="entry-title"><?php the_title(); ?></h1> </div><!-- .col --> </div><!-- .row --> <div class="row"> <div class="col-md-8 col-sm-7 col-xs-12"> <?php echo "".types_render_field("varebil-data-billede", array("output"=>"HTML")); ?> <p><a href="#"><div class="mediumButton">Send mig et tilbud på <?php the_title(); ?></div></a></p> </div><!-- .col --> <div class="col-md-4 col-sm-5 col-xs-12"> <div class="bilSingleData"> <div class="row rowData"> <div class="col-md-4 col-sm-4 col-xs-4"><?php echo "Model</div><div class='col-md-8 col-sm-8 col-xs-8 right'>".types_render_field("varebil-data-model", array("output"=>"HTML")); ?></div> </div><!-- .rowData --> <div class="row rowData"> <div class="col-md-4 col-sm-4 col-xs-4"><?php echo "Månedlig leasing afgift</div><div class='col-md-8 col-sm-8 col-xs-8 right'>".types_render_field("varebil-data-manedlig-leasing-afgift", array("output"=>"HTML")); ?> kr.</div> </div><!-- .rowData --> <div class="row rowData"> <div class="col-md-4 col-sm-4 col-xs-4"><?php echo "Forbrug</div><div class='col-md-8 col-sm-8 col-xs-8 right'>".types_render_field("varebil-data-forbrug", array("output"=>"HTML")); ?> km/l</div> </div><!-- .rowData --> <div class="row rowData"> <div class="col-md-4 col-sm-4 col-xs-4"><?php echo "Miljøkategori</div><div class='col-md-8 col-sm-8 col-xs-8 right'>".types_render_field("varebil-data-miljokategori", array("output"=>"HTML")); ?></div> </div><!-- .rowData --> <div class="row rowData"> <div class="col-md-4 col-sm-4 col-xs-4"><?php echo "CO2</div><div class='col-md-8 col-sm-8 col-xs-8 right'>".types_render_field("varebil-data-kuldioxid", array("output"=>"HTML")); ?> g/km</div> </div><!-- .rowData --> <div class="row rowData"> <div class="col-md-12 col-sm-12 col-xs-12"><?php echo "</div><div class='col-md-12 col-sm-12 col-xs-12 left'>".types_render_field("varebil-data-ekstra", array("output"=>"HTML")); ?></div> </div><!-- .rowData --> </div><!-- .bilSingleData --> </div><!-- .col --> </div><!-- .row --> <?php endwhile; // end of the loop. ?>
functions.php:
// Add featured image sizes (width, height, crop) add_image_size( 'featured-varebiler', 378, 252, true );