<div class="jumbotron bg-black">
<div class="row">
<div class="container experience">
<hr>
<h2><strong>EXPERIENCIA</strong></h2>
<hr style="width:300px;">
<div id="myCarousel2" style="height:250px;" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<?php
$query = new WP_Query(array( 'post_type' => 'testimonial','p' => $id, 'order' => 'ASC', 'showposts' => '11'));
$i = 0;
if($query->have_posts()):
while($query->have_posts()) : $query->the_post();
if($i == 0) { ?>
<li data-target="#myCarousel2" data-slide-to="<?php echo $i;?>" class="active"></li>
<?php
}else { ?>
<li data-target="#myCarousel2" data-slide-to="<?php echo $i;?>"></li>
<?php
}
$i++;
endwhile;
else: ?>
<p><?php _e( 'Oh God Why?' ); ?></p>
<?php endif;
?>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" >
<?php
$j = 0;
if($query->have_posts()):
while($query->have_posts()) : $query->the_post();
if($use_excerpt){
$testimonial['content'] = get_the_excerpt();
} else {
$testimonial['content'] = get_the_content();
}
if($j == 0) { ?>
<div class="item active" style="height:250px; width:800px;">
<?php
}else { ?>
<div class="item" style="height:250px; width:800px;">
<?php
} ?>
<div class="carousel-caption" style="width:800px;">
<p> <?php echo $testimonial['content']; ?></p>
</div>
</div>
<?php
$j++;
endwhile;
endif;
wp_reset_postdata();
?>
</div>
</div>
</div>
</div>
</div>
</div>
And here is my code of my template page:
<?php
/*
Template Name: Nosotros
*/
get_header();
?>
<div class="jumbotron-2">
<div class="row">
<div class="banner">
<img src="<?php bloginfo('template_url')?>/img/banner/empresa.jpg" class="img-responsive" alt="">
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="row">
<div class="icon-b"><img src="<?php bloginfo('template_url')?>/img/icon-b.png" class="img-responsive" alt=""></div>
<h2 style="text-align:center;"><strong><?php the_title(); ?></strong></h2>
<hr>
<div class="col-lg-4 col-md-4 col-ms-4"><br><img src="<?php bloginfo('template_url')?>/img/empresa.jpg" class="img-circle" alt="Empresa PERCHISA Perforaciones en Chihuahua SA de CV"></div>
<div class="col-lg-8 col-md-8 col-ms-8">
<?php
if (have_posts()) : while (have_posts()) : the_post();
the_content();
endwhile; else: ?>
<h1>No se encontraron articulos</h1>
<?php
endif;
rewind_posts();
?>
</div>
</div>
</div>
</div>
<hr>
</div>
<!-- EXPERIENCES -->
<?php include(TEMPLATEPATH. '/slideshow.php'); ?>
<!-- END / EXPERIENCES -->
<?php get_footer(); ?>
If I move the include before the main loop is executed it works, I will apreciate your help.
]]>I want to remove the recent products section and replace it with a second loop to show post excerpts but excluding the category of the post already shown at the top of the page.
So far I’ve only been getting errors. The code I’m using for the second loop is as follows:
<?php query_posts('cat=-83'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
The code I’m using to actually display the posts is the same as that used to display the “featured post” at at the top of the page, which is:
<article>
<?php post_class(); ?>>
<?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] != 'content' ) { woo_image( 'width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail ' . $woo_options['woo_thumb_align'] ); } ?>
<header>
<h2>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h2>
</header>
<section class="entry">
<?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading →', 'woothemes' ) ); } else { the_excerpt(); } ?></section>
</article><!-- /.post -->
So the code in its entirety is as follows:
<?php query_posts('cat=-83'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<article <?php post_class(); ?>>
<?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] != 'content' ) { woo_image( 'width=' . $woo_options['woo_thumb_w'] . '&height=' . $woo_options['woo_thumb_h'] . '&class=thumbnail ' . $woo_options['woo_thumb_align'] ); } ?>
<header>
<h2>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</h2>
</header>
<section class="entry">
<?php if ( isset( $woo_options['woo_post_content'] ) && $woo_options['woo_post_content'] == 'content' ) { the_content( __( 'Continue Reading →', 'woothemes' ) ); } else { the_excerpt(); } ?></section>
</article><!-- /.post -->
<?php endwhile; ?>
This is the error I’m getting:
Parse error: syntax error, unexpected $end in...
This is the related content loop:
<?php
$scores = the_related_get_scores($post->ID, true);
$posts = array_slice( array_keys( $scores ), 0, 3 );
$args = array('post__in' => $posts, 'post_type' => 'project', 'posts_per_page' => 3 );
$my_query = new WP_Query( $args );
if ( $my_query->have_posts() ) {
while ( $my_query->have_posts() ) {
$my_query->the_post();?>
<!-- do stuff ... -->
<?php echo '';
}
}
else {
echo "--";
}
?>
And this is the way I tried to display the current post, but it doesnt work:
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- do stuff ... -->
<?php endwhile; ?>
<?php endif; ?>
I dont have much experience on this, so any help would be appreciated. thanks
]]>Here’s the homepage code now:
Thanks for help in advance!
]]>I’m using get_pages to display sub page content on the parent page. It’s working fine for outputting the post title and content, but I can’t seem to figure out how to get it to output my custom fields.
Here’s the code I’m using:
<?php
$mypages = get_pages('child_of=30&sort_column=post_date&sort_order=desc');
foreach($mypages as $page)
{
$content = $page->post_content;
if(!$content) // Check for empty page
continue;
$content = apply_filters('the_content', $content);
?>
<h5><a href="<?php echo get_page_link($page->ID) ?>"><span><?php echo $page->post_title ?></span></a></h5>
<p><?php echo $content ?></p>
<?php
}
?>
Any help would be gratefully received! Thanks!
]]><?php
$args = array( 'posts_per_page=>5', 'orderby' => 'ASC', 'category' => 137 );
$hotbuy_posts = get_posts( $args );
foreach( $hotbuy_posts as $post ) : ?>
<p><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br />
<?php the_excerpt(); ?>
</p>
<?php endforeach; ?>
Any assistance is greatly appreciated.
]]><?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php $i = 0; ?>
<?php while (have_posts()) : the_post(); $i++; ?>
<div class="span-8 post-<?php the_ID(); ?><?php if ($i == 3) { ?> last<?php } ?>">
<h6 class="archive-header"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6>
<?php
$values = get_post_custom_values("thumbnail");
if (isset($values[0])) {
?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("thumbnail"); echo $values[0]; ?>" alt="" /></a>
<?php } ?>
<?php the_excerpt(); ?>
<p class="postmetadata"><?php the_time('M d, Y') ?> | <?php comments_popup_link('Have your say »', '1 Comment »', '% Comments »'); ?></p>
</div>
<?php if ($i == 3) { ?><div class="archive-stack clear"></div><?php $i = 0; } ?>
<?php endwhile; ?>
<div class="clear"></div>
<div class="navigation">
<div><?php next_posts_link('« Older Entries') ?></div>
<div><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php else : ?>
<h2>Not Found</h2>
<p>Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php endif; ?>
<?php include (TEMPLATEPATH . "/bottom.php"); ?>
<?php get_footer(); ?>
And the code I’m using in the blog page
<?php
/*
Template Name: Blog
*/
get_header(); ?>
<?php $posts = get_posts( "numberposts=12" ); ?>
<?php if( $posts ) : ?>
<?php foreach( $posts as $post ) : setup_postdata( $post ); ?>
<div class="post">
<p class="post-info-home"><h6><?php the_title(); ?></p></h6>
<div class="post-title-home">
<?php the_time('d M Y h:i a'); ?>
</div>
<div class="entry">
<?php the_excerpt(); ?>
<em><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link: <?php the_title(); ?>">READ ENTIRE POST</a></em>
</div>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php include (TEMPLATEPATH . "/bottom.php"); ?>
<?php get_footer(); ?>
Any help would be much appreciated. Thanks.
]]>wp_list_pages()
though, because I need to use some custom fields from those subpages.
So I get those pages with a custom SELECT query directly from the database and create a second loop after the first one, as per these instructions on the Codex.
The problem is this: inside the second loop, template tags like the_title()
and the_permalink()
still output their values for the parent page, instead of the subpage the loop is working on at that point. Things like get_post_meta()
and the_ID()
do contain the right values however.
Does anyone have any idea why this is, and how I can fix or work around it?
Or is there perhaps an easier way to to this that I’m not aware of?
Thanks in advance.
]]>