Picked up the code from other theme i've been training on, where it was working perfectly fine. However, here, i can't get it to display content. No trace of posts on index page at all. And on other pages, it only shows page titles.
website here:
soloveich.com
index page content code
<?php
get_header(); ?>
<div class="body">
<div class="row-fluid">
<div class="span2"></div>
<div class="span8" id="conty">
<div id="title"><h4>Your Company Name</h4></div>
<div id="content">
<?php while ( have_posts() ) : the_post() ?>
<?php get_template_part( 'entry' ); ?>
<?php endwhile; ?>
</div>
</div>
<div class="span2"></div>
</div>
</div>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="<?php bloginfo('template_url');?>/js/bootstrap.min.js"></script>
</body>
</html>
other pages code
<?php
get_header(); ?>
<div class="body">
<div class="row-fluid">
<div class="span2"></div>
<div class="span8" id="conty">
<div id="title"><h4><?php the_title(); ?></h4></div>
<div id="content">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?>
<?php the_content(); ?>
</div>
</div>
<div class="span2"></div>
</div>
</div>
</div>
</body>
</html>
Related
Here is showing only last created post when i am clicking on readmore button of post.
remember i have called all posts on another template(our_program.php inplace of index.php) all posts are showing well but on single.php here is only only one recent post showing when i am clicking on read more of any post. my single.php code is below
<?php $args = array( 'post_type' => 'post');
query_posts($args);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<section class="talent-development" id="telent-development">
<div class="container">
<div class="row">
<div class="section-content-text clearfix">
<div class="col-sm-12">
<h2><?php the_title(); ?></h2>
</div>
<div class="col-sm-5">
<div class="ourProgramImg">
<?php if( has_post_thumbnail()){
the_post_thumbnail();
}
?>
</div>
</div>
<div class="col-sm-7">
<div class="ourProgramContent">
<p>
<?php the_content();?>
</p>
</div>
</div>
</div>
<!--<div class="col-sm-6">
<div class="section-content-img">
<img src="img/sec.jpg" alt="" title="" />
</div>
</div>-->
</div>
</div>
</section>
<?php endwhile; else: ?>
<p> Not post Found </p>
<?php endif; ?>
and post page(permalink) code below
<?php $args = array( 'post_type' => 'post');
query_posts($args);
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<section class="talent-development" id="telent-development">
<div class="container">
<div class="row">
<div class="section-content-text clearfix">
<div class="col-sm-12">
<h2><?php the_title(); ?></h2>
</div>
<div class="col-sm-5">
<div class="ourProgramImg">
<?php if( has_post_thumbnail()){
the_post_thumbnail();
}
?>
</div>
</div>
<div class="col-sm-7">
<div class="ourProgramContent">
<p>
<?php echo substr(get_the_excerpt(), 0, 400); //the_content();?>
</p>
Read More
</div>
</div>
</div>
<!--<div class="col-sm-6">
<div class="section-content-img">
<img src="img/sec.jpg" alt="" title="" />
</div>
</div>-->
</div>
</div>
</section>
<?php endwhile; else: ?>
<p> Not post Found </p>
<?php endif; ?>
I created my own template in WordPress, but the loop entries does not work. I would like to entries work on one of the subpages. I also added entries.
This is my code of my subpage. Please help me. I don't know what is wrong. I added a picture under the code.
<?php include 'header.php'; ?>
<main class="subpage-blog">
<div class="subpage-banner">
<div class="container">
<h3>BLOG SIDEBAR</h3>
<div class="breadcrumbs">
</div>
</div>
</div>
<aside class="side-menu col-md-4">
<div class="search">
<h4>Search blog</h4>
<input type="text" value="Search">
</div>
<!-- .search -->
<div class="categories">
<h4>Blog Categories</h4>
<ul class="categories-blog-ul">
<li>Inspirtation</li>
<li>Work</li>
<li>Tech</li>
<li>Creative</li>
</ul>
</div>
<!--.categories-->
<div class="recent-posts">
<h4>Recents posts</h4>
<ul>
</ul>
</div>
<!-- .recent-posts-->
<div class="tags-spot">
<h4>Tags</h4>
<div class="tag"></div>
</div>
<!-- .tags-spot-->
</aside>
<!-- .side-menu-->
<article class="content">
<div class="container">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="news-box">
<div class="news-list-content">
<a href="">
<h3><?php the_title(); ?></h3>
<?php the_content('czytaj dalej'); ?>
</a>
</div>
<!-- .news-list-content-->
<div class="image-box-news">
<img src="<?=get_template_directory_uri(); ?>/images/ikona-wpisu.png" alt="" />
</div>
</div>
<!-- .news-box-->
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
</div>
<!-- .container-->
</article>
<!-- .content-->
</main>
<?php include 'footer.php'; ?>
The problem is that:
if (have_posts()) : while (have_posts()) : the_post();
is using the current page's have_posts query.. That means that it probably will just show whatever that current page template's content would be.
Instead, you'll want to create an entirely new query object and call these functions on it like so:
<?php
$the_query = new WP_Query( array('posts_per_page' => 10 ) ); //Create our new custom query
if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); ?>
<div class="news-box">
<div class="news-list-content">
<h3><?php the_title(); ?></h3>
<?php the_content('czytaj dalej'); ?>
</div>
<!-- all your other markup goes here.... -->
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<?php wp_reset_postdata(); //Restore the original postdata for this page, if needed later ?>
when you go to:
http://dageniusmarketer.com/
you will see the posts have 2 images. I'm trying to remove the one on the bottom.
I initially added
<?php the_post_thumbnail( $size, $attr ); ?>
for the main post image, as I wasn't getting the placement I wanted, which was ABOVE the post statistics. Now that I have it above the statistics, I still have the original image, and I want to remove it.
I'm trying to play with the class .wp-image,
but that isn't giving me any sort of luck. I just want to remove the 2nd duplicate image underneath the statistics and keep whatever other images I may wish to write into my post body in the future. How do I do this?
edit: here is my php code:
<?php get_header(); ?>
<div id="main">
<div id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<!-- item -->
<div class="item entry" id="post-<?php the_ID(); ?>">
<div class="itemhead">
<h1>
<?php the_title(); ?>
</h1>
<?php the_post_thumbnail( $size, $attr ); ?>
<div class="postStatsContainer">
<div class="postViews">100 Views</div>
<div class="slash"></div>
<div class="postShares">100 Shares</div>
<div class="slash"></div>
<div class="postComments">100 Comments</div>
<div class="slash"></div>
<div class="date"><?php the_time('M jS, Y') ?></div>
</div>
<div style="clear: both"></div>
<!--<div class="readMore_Container">-->
<?php the_content('Read More »'); ?>
<div class="postCounter">
<i class="fa fa-pencil-square-o fa-2x"></i>#200
</div>
<div class="metadata" style="clear:both;">
<div class="TagIcon"></div>
Filed under
<span class="category"><?php the_category(', ') ?></span> |
<?php edit_post_link('Edit', '', ' | '); ?>
<?php comments_popup_link('Comment (0)', ' Comment (1)', 'Comments (%)'); ?>
</div>
<div style="clear:both;"></div>
<div style="clear:both;"></div>
</div>
</div>
<!-- end item -->
<?php comments_template(); // Get wp-comments.php template ?>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
<p> </p>
</div>
<?php else : ?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php endif; ?>
<!-- end content -->
</div>
<div id="primary">
<?php include(TEMPLATEPATH."/l_sidebar.php");?>
</div>
<div id="secondary">
<?php include(TEMPLATEPATH."/r_sidebar.php");?>
</div>
<?php get_footer(); ?>
I would like some help if possible in the following question:
I use in my Genesis theme a bootstrap grid, and would like to display the search results using this grid.
I created a search.php with the following code:
<?php
/**
* Search Results Template File
*/
get_header(); ?>
<header>
<h1>Search Results: "<?php echo get_search_query(); ?>"</h1>
<br>
</header>
<?php if ( have_posts() ) : // results found?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="gr-infos-container-cliente">
<div class="gr-promo-do-cliente"><?php the_field('tipo_de_promo');?></div>
<div class="gr-img-cliente"><img src="<?php echo get_field('foto_cliente_miniatura');?>" alt="" class="img-responsive center-block"></div>
<div class="gr-nome-cliente"><?php the_title();?></div>
<div class="gr-tagline-cliente"><?php the_field('tagline_do_anunciante');?></div>
<div class="gr-bairro-do-cliente"><i class="cliente fa fa-map-marker"></i><?php the_field('bairro_do_cliente');?></div>
</div>
</div>
</div> <!-- Row -->
</div> <!-- Container -->
<?php endwhile; ?>
<?php else : // no results?>
<article>
<h1>No Results Found.</h1>
</article>
<?php endif; ?>
<?php get_footer(); ?>
genesis();
But in the search result, the content is aligned one on top of another and not in the selected grid.
Any tips you can give me?
I am very grateful for any help!
This is due to that your 'row' div is inside the while loop, causing it to generate multiple 'row' div instead of one.
To fix this, you'll need to place the while loop inside the 'row' div.
Try the code bellow
<?php
/**
* Search Results Template File
*/
get_header(); ?>
<header>
<h1>Search Results: "<?php echo get_search_query(); ?>"</h1>
<br>
</header>
<?php if ( have_posts() ) : // results found?>
<div class="container-fluid">
<div class="row">
<?php while ( have_posts() ) : the_post(); ?>
<div class="col-md-3 col-sm-6 col-xs-12">
<div class="gr-infos-container-cliente">
<div class="gr-promo-do-cliente"><?php the_field('tipo_de_promo');?></div>
<div class="gr-img-cliente"><img src="<?php echo get_field('foto_cliente_miniatura');?>" alt="" class="img-responsive center-block"></div>
<div class="gr-nome-cliente"><?php the_title();?></div>
<div class="gr-tagline-cliente"><?php the_field('tagline_do_anunciante');?></div>
<div class="gr-bairro-do-cliente"><i class="cliente fa fa-map-marker"></i><?php the_field('bairro_do_cliente');?></div>
</div>
</div>
<?php endwhile; ?>
</div> <!-- Row -->
</div> <!-- Container -->
<?php else : // no results?>
<article>
<h1>No Results Found.</h1>
</article>
<?php endif; ?>
<?php get_footer(); ?>
genesis();
I started to use Wordpress for a project, and using the following plugin Download Monitor
My page listings based on taxonomies all work fine, but im struggling with the search results
My form
<form role="search" method="get" class="right" id="download-form" action="<?php echo home_url( '/' ); ?>">
<div>
<input type="text" value="" name="dlm_download" id="dlm_download" placeholder="Search" />
</div>
</form>
So when i search and get the results mywebsite.com/?dlm_download=querythe home page gets show.
Than i created after research search-dlm_download.php, still get redirected to home.
Than i found this thread How to create a custom search for custom post type on wordpress exchange that does not work either.
So i am a bit stuck, could someone please point out what i am doing wrong?
EDIT:
search-dlm_download.php
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<div id="page" class="border-top clearfix">
<div id="subtitle">
<h1><?php _e("Search Results for '$s'", 'framework') ?></h1>
<div id="breadcrumb"><?php the_breadcrumb(); ?></div>
<div class="hr4"><span class="seperator"></span><span class="lightborder"></span></div>
</div>
<div id="content-part">
<?php while (have_posts()) : the_post(); ?>
<div class="search-entry post-entry">
<h2><?php the_title(); ?></h2>
<div class="meta">
<?php _e('Posted on', 'framework'); ?> <strong><?php the_time('d.m.Y'); ?></strong> · <?php _e('Posted in', 'framework'); ?> <?php the_category(', ') ?>
</div>
<div class="entry">
<?php wpe_excerpt('wpe_excerptlength_blog', 'wpe_excerptmore'); ?>
</div>
<div class="entry-footer"></div>
</div>
<?php endwhile; ?>
<?php include (TEMPLATEPATH . '/framework/functions/nav.php' ); ?>
</div>
<div id="sidebar" class="sidebar-right">
<?php get_sidebar(); ?>
</div>
</div>
<?php else : ?>
<div id="page" class="border-top clearfix">
<div id="subtitle">
<h1><?php _e('No Results Found', 'framework') ?></h1>
<div id="breadcrumb"><?php the_breadcrumb(); ?></div>
<div class="hr4"><span class="seperator"></span><span class="lightborder"></span></div>
</div>
<div class="wrap clearfix">
<div id="content-part">
<div class="no-search-result">
<p><?php _e("Sorry, no results found. Try different words to describe what you are looking for.", 'framework') ?></p>
</div>
</div>
<div id="sidebar" class="sidebar-right">
<?php get_sidebar(); ?>
</div>
</div>
</div>
<?php endif; ?>
<?php get_footer(); ?>
Okay, found a solution by breaking the default search to 2 parts
If anybody needs it in the future you can find it here Create multiple search templates for custom post types