-1

I got a Custom Post Type Page, this is the code I use:

<?php
 get_header();
 get_sidebar();
 the_meta();
?>

<ul class="event">
  <?php $args = array( 'post_type' => 'event-netzwerk', 'posts_per_page' => 30, 'orderby' => 'rand' );
  $loop = new WP_Query( $args );
  while ( $loop->have_posts() ) : $loop->the_post();
    echo '<li>';
    the_title('<h3>', '</h3>');
    the_content();
    echo '</li>';
  endwhile; ?>
</ul> 


<?php

 get_footer();
?>

Does anybody knows how I can add an AFC there?

rnevius
  • 26,578
  • 10
  • 58
  • 86
Luca Koch
  • 1
  • 1

2 Answers2

1

To display ACF in your theme use the_field()

<h1><?php the_field('custom_title'); ?></h1>
Dinesh
  • 4,066
  • 5
  • 21
  • 35
  • That can't be anything, I don't want to use a plugin. I want to code it by my self. But I can't find any good tutorial on the Internet – Luca Koch Nov 14 '14 at 09:14
  • If you want to add a meta box, but not an Advanced Custom Field, then your question is off topic. "ACF" stands for Advanced Custom Fields...which is a plugin. @Dinesh has a correct answer. – rnevius Nov 14 '14 at 09:19
  • I already added Custom Post Type into my theme, and now I want to add (Advanced) Custom Fields. If Advanced(...) is a plugin, than I am sorry. I don't want to install a plugin I need a few codes for coding it into my template – Luca Koch Nov 14 '14 at 09:32
  • 1
    You're trying to add meta boxes, values, and keys. Not fields. http://codex.wordpress.org/Function_Reference/add_meta_box – rnevius Nov 14 '14 at 10:21
1

You can use the_field function.

the_field("your_custom_field");

https://wordpress.org/plugins/advanced-custom-fields/screenshots/

CRABOLO
  • 8,605
  • 39
  • 41
  • 68
user3136884
  • 161
  • 2
  • 9