You may alter the main query before the loop, but it’s crucial to reset the main query afterwards. Otherwise you’ll probably run into problems elsewhere.
Disclaimer: Doing this is officially discouraged by WordPress here. However, in my experience it works perfectly to achieve the behaviour you want. Just don’t forget to add wp_reset_query(); after closing the loop.
<?php query_posts('post_type=event'); ?>
<?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
<!-- Stuff happening inside the loop -->
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Another approach (slightly more complicated but without altering the main query) would be:
<?php $args = array( 'posts_per_page' => 10, 'post_type' => 'event', 'post_status' => 'publish' ); ?>
<?php $get_category_posts = get_posts( $args ); ?>
<?php foreach ( $get_category_posts as $post ) : setup_postdata( $post ); ?>
<!-- Stuff happening inside our custom 'loop' -->
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
According to the 2nd solution, your PHP-File should look like this:
<?php get_header(); ?>
<?php $args = array( 'posts_per_page' => 10, 'post_type' => 'event', 'post_status' => 'publish' ); ?>
<?php $get_category_posts = get_posts( $args ); ?>
<?php foreach ( $get_category_posts as $post ) : setup_postdata( $post ); ?>
<div class="class1">
<div class="class2">
<div class="class3">
<?php print_r( get_post_meta( get_the_ID() ) ); // Just for demo purposes ?>
<?php // $url = esc_url( get_post_meta( get_the_ID(), 'video_oembed', true ) ); ?>
<?php // $embed = wp_oembed_get( $url ); ?>
<div class="class4">
<iframe id="class_frame" width="560" height="315" src="https://www.youtube.com/watch" allowfullscreen frameborder="0"></iframe>
</div>
</div>
<div class="class6">
<h1><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
</div>
</div>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php get_footer(); ?>
If this doesn’t work it might be that you’re working in the wrong template file. Without knowing your project my guess would be that it should be archive-event.php
Update:
It turned out to be taxonomy-event.php in this case.