This question already has an answer here:
I seem to be getting a very silly error, wether i am just over looking an error in the code, but i just cant figure it out. this is the code that is effected.
<form method="POST" action="/search-items/">
<?php
$terms = get_terms('location');
if(!emtpy($terms) && !is_wp_error($terms)):
echo '<select name="location">';
foreach($terms as $term):
echo '<option value="'. $term->slug .'">'.$term->name.'</option>';
echo '</select>';
endif;
?>
<input type="hidden" name="submitted" value="Y">
<input type="submit" value="Swap Now">
</form>
This is the full page code.
It is the endif; that is getting called to error.
Full Page Code:
<?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?>
<?php
/* Template Name: Full width custome */
get_header(); ?>
<!-- CONTENT -->
<div id="primary" class="site-content">
<div id="content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) : ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div><!-- .entry-page-image -->
<?php endif; ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of loop. ?>
<form method="POST" action="/search-items/">
<?php
$terms = get_terms('location');
if(!emtpy($terms) && !is_wp_error($terms)):
echo '<select name="location">';
foreach($terms as $term):
echo '<option value="'. $term->slug .'">'.$term->name.'</option>';
echo '</select>';
endif;
?>
<input type="hidden" name="submitted" value="Y">
<input type="submit" value="Swap Now">
</form>
<div class="rh-container">
<!-- Main Side -->
<div class="items">
<?php
$args = array(
"order" => "asc",
"order_by" => "title",
"posts_per_page" => 12,
"post_type" => "product",
);
$wp_query = new WP_Query($args);
if($wp_query->have_posts()):
while($wp_query->have_posts()):
$wp_query->the_post();
echo get_the_title();
the_content();
the_post_thumbnail();
endwhile;
wp_reset_postdata();
endif;
?>
</div>
<!-- /Main Side -->
</div>
<!-- /CONTENT -->
<!-- FOOTER -->
<?php get_footer(); ?>
Aucun commentaire:
Enregistrer un commentaire