I want to create a blog inside my web but I already create the custom page but when i make posts with the tag “Blog” they also appear in my index i just i want them on my page Called Blog.php. How can i do that?
this is my template code
<pre>
<?php
/*
template name: Blog
*/
?>
<?php get_header(); ?>
<div class="switch">
<div class="switch-left">
<span style="text-shadow:0 1px 23px #ff0000;color: #000;">Blog de Noticias</span>
</div>
< /div>
<div class="main section" id="main">
<div class="widget Blog" id="Blog1">
<div class="blog-posts hfeed">
<?php query_posts('tag=Blog'); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post bar hentry">
<h3 class="post-title entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="post-header-line-1"></div>
<div class="post-body entry-content">
<div class="box-peli">
<span style="float:left; padding:0px 10px 5px 0px;">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<?php if ( has_post_thumbnail() ) {
$foto = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium' );
$src = $foto['0'];
echo '<img src="'.$src.'" class="alignnone" alt="'.get_the_title().'" width="114" height="170">';
}else{ ?>
<img src="<?php bloginfo('template_url');?>/images/no-image.jpg" class="alignnone" alt="<?php the_title();?>" width="114" height="170"/>
<?php }?>
</a>
</span>
</div>
</div>
<div style="clear: both;"></div>
</div>
<?php endwhile; endif; ?>
</div>
<div class="blog-pager" id="blog-pager">
<?php if(function_exists('pagenavi')) { pagenavi(); } ?>
</div>
<div class="clear"></div>
<?php if(!is_paged()) { ?>
<div id="slide-wrapper">
<div class="slide section" id="slide">
<div class="widget HTML" id="HTML4">
<div id="maskolis">
<?php get_template_part('postsByTag');?>
</div>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
<?php get_footer();?>
Use this code instead of
It was close but not quite there, let me know how it worked out for you.
FROM YOUR CODE:
Make it this:
Look inside your WordPress, your slug should be like “blog” or “Blog” if its incorrect it won’t work. It is not exactly as displayed for example in WordPress it will show stuff like “Home Blog” but the slug is “home-blog”.. Make sure you find a correct slug.