Comment out page title in Coraline theme/Wordpress - php

Can someone advise where to comment out the page title in Coraline theme? I've tried different things and it does not work. Here's my page.php
<div id="content-container">
<div id="content" role="main">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if ( is_front_page() ) { ?>
<h2 class="entry-title"><?php the_title(); ?></h2>
<?php } else { ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php } ?>
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'coraline' ), 'after' => '</div>' ) ); ?>
<?php edit_post_link( __( 'Edit', 'coraline' ), '<span class="edit-link">', '</span>' ); ?>
</div> <!-- .entry-content
</div> <!-- #post-## -->
<?php comments_template( '', true ); ?>
<?php endwhile; ?>
</div><!-- #content -->
</div><!-- #content-container -->

I would assume it would be this line:
<h1 class="entry-title"><?php the_title(); ?></h1>
To comment out, replace with:
<!--<h1 class="entry-title"><?php the_title(); ?></h1>-->
You can also just leave the Title box empty when creating a new page in the admin panel.

Related

Wordpress doesn't show excerpt when comments are off

i have a problem with my wordpress theme. It works, but when i would like to turn the comments off, it doesn't show me the excerpt.
The first picture shows how it look like when comments are allowed, the second picture shows it when comments are not allowed.
Comments allowed
Comments off
Here is the code snippet from content.php page:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<div class="entry-header-title">
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
<?php endif; // is_single() ?>
<span class="entry-meta-date">
<?php twentythirteen_entry_date(); ?>
<span>|</span>
<?php if ( comments_open() && ! is_single() ) : ?>
<span class="entry-comments" >
<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a Reply', 'twentythirteen' ) . '</span>', __( '1 Comment', 'twentythirteen' ), __( '% Comments', 'twentythirteen' ) ); ?>
</span><!-- .entry-comments -->
</span><!-- .entry-meta -->
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<div class="entry-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
</div>
</header><!-- .entry-header -->
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><div class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</div>', 'after' => '</div>', 'link_before' => '<div>', 'link_after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
<footer class="entry-meta">
<?php endif; // comments_open() ?>
<div class="entry-labels">
<?php twentythirteen_entry_meta(); ?>
</div>
<div class="entry-share">
<?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
</div>
<div class=".post-spacer">
</div>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<div class="linkwithin_div"></div>
You accidentally deleted an <?php endif;?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<div class="entry-header-title">
<?php if ( is_single() ) : ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<?php else : ?>
<h1 class="entry-title">
<?php the_title(); ?>
</h1>
<?php endif; // is_single() ?>
<span class="entry-meta-date">
<?php twentythirteen_entry_date(); ?>
<span>|</span>
<?php if ( comments_open() && ! is_single() ) : ?>
<span class="entry-comments" >
<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a Reply', 'twentythirteen' ) . '</span>', __( '1 Comment', 'twentythirteen' ), __( '% Comments', 'twentythirteen' ) ); ?>
</span><!-- .entry-comments -->
</span><!-- .entry-meta -->
//THIS ONE
<?php endif; // comments_open() ?>
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<div class="entry-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
</div>
</header><!-- .entry-header -->
<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentythirteen' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><div class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</div>', 'after' => '</div>', 'link_before' => '<div>', 'link_after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
<?php endif; ?>
<footer class="entry-meta">
<div class="entry-labels">
<?php twentythirteen_entry_meta(); ?>
</div>
<div class="entry-share">
<?php if( function_exists('ADDTOANY_SHARE_SAVE_KIT') ) { ADDTOANY_SHARE_SAVE_KIT(); } ?>
</div>
<div class=".post-spacer">
</div>

wp_loop results in one conteiner but in two divs?

I have extra field in my template, it looks like:
" >
<div class="entry-content clearfix">
<div class="col-left">
<?php the_content(); ?>
</div>
<div class="col-right">
<?php
if(function_exists('get_field')) {
$sc = get_field('second_column');
echo apply_filters( the_post_thumbnail( 'thumbnail' ), $sc );
}
?>
</div>
</div><!-- .entry-content -->
</div><!-- #post-## -->
It should be like that: col-left displaying posts (recent 10) and in col-right displaying thumnail to each post.
How I should put while, to have all content inside this template? Sitting a while on it, and no idea for it. The best, but not working as I need, is:
<?php if ( $category_posts->have_posts() ) ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content clearfix">
<div class="col-left">
<?php while ( $category_posts->have_posts() ) : $category_posts->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
</div>
<div class="col-right">
<?php
while ( $category_posts->have_posts() ) : $category_posts->the_post();
if(function_exists('get_field')) {
$sc = get_field('second_column');
echo apply_filters( the_post_thumbnail( 'thumbnail' ), $sc );
}
?>
</div>
</div><!-- .entry-content -->
</div><!-- #post-## -->
Tomu, if you want to run loop twice on same page than you have to use <?php rewind_posts(); ?>. You can try below code.
<?php if ( $category_posts->have_posts() ) ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content clearfix">
<div class="col-left">
<?php while ( $category_posts->have_posts() ) : $category_posts->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
</div>
<div class="col-right">
<?php rewind_posts(); ?>
<?php
while ( $category_posts->have_posts() ) : $category_posts->the_post();
if(function_exists('get_field')) {
$sc = get_field('second_column');
echo apply_filters( the_post_thumbnail( 'thumbnail' ), $sc );
}
?>
</div>
</div><!-- .entry-content -->

Not sure where to put this code for my custom post type?

I have a custom post type (called 'discount') that I am trying to display in the twentythirteen theme. I created a custom page file called discount-page.php to create my own template for this post type. I'm not sure where I need to place the wp_query code, however. Here's what the default page.php looks like, with an addition of the new template name:
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<div class="entry-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<?php comments_template(); ?>
<?php endwhile; ?>
</div><!-- #content -->
</div><!-- #primary -->
Now, I'm fairly sure that in order for my posts to actually show their content, I need to add this block of code to the discount-page.php:
<?php
$query = new WP_Query( array('post_type' => 'discount', 'posts_per_page' => 5 ) );
while ( $query->have_posts() ) : $query->the_post(); ?>
// Your code e.g. "the_content();"
<?php endif; wp_reset_postdata(); ?>
<?php endwhile; ?>
I just have no idea where to add it? It seems to break the page no matter where I add it.
You just have to change a couple of lines of code for it to work.
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php /* The loop */ ?>
<?php
$query = new WP_Query( array('post_type' => 'discount', 'posts_per_page' => 5 ) );
while ( $query->have_posts() ) : $query->the_post(); ?> ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php if ( has_post_thumbnail() && ! post_password_required() ) : ?>
<div class="entry-thumbnail">
<?php the_post_thumbnail(); ?>
</div>
<?php endif; ?>
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentythirteen' ) . '</span>', 'after' => '</div>', 'link_before' => '<span>', 'link_after' => '</span>' ) ); ?>
</div><!-- .entry-content -->
<footer class="entry-meta">
<?php edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
<?php comments_template(); ?>
<?php endwhile; wp_reset_postdata(); ?>
</div><!-- #content -->
</div><!-- #primary -->
If you want the super simple version of it removing everything else. Try this:
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
$query = new WP_Query( array('post_type' => 'discount', 'posts_per_page' => 5 ) );
while ( $query->have_posts() ) : $query->the_post();
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<?php the_content(); ?>
</div>
</article>
<?php endwhile; wp_reset_postdata(); ?>
</div>
</div>

How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1

Hi I want to show only standard format in my custom taxonomy:
Actually I have many category and format in my project , hence on this page I need only to show standard format and specific category
<?php
/**
* Locations taxonomy archive
*/
get_header();
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
?>
<div class="wrapper">
<div class="primary-content">
<h1 class="archive-title"><?php echo apply_filters( 'the_title', $term->name ); ?> News</h1>
<?php if ( !empty( $term->description ) ): ?>
<div class="archive-description">
<?php echo esc_html($term->description); ?>
</div>
<?php endif; ?>
<?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class('post clearfix'); ?>>
<h2 class="post-title"><?php the_title(); ?></h2>
<div class="content clearfix">
<div class="post-info">
<p><?php the_time(get_option('date_format')); ?> by <?php the_author_posts_link(); ?></p>
</div><!--// end .post-info -->
<div class="entry">
<?php the_content( __('Full story…') ); ?>
</div>
</div>
</div><!--// end #post-XX -->
<?php endwhile; ?>
<div class="navigation clearfix">
<div class="alignleft"><?php next_posts_link('« Previous Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Next Entries »') ?></div>
</div>
<?php else: ?>
<h2 class="post-title">No News in <?php echo apply_filters( 'the_title', $term->name ); ?></h2>
<div class="content clearfix">
<div class="entry">
<p>It seems there isn't anything happening in <strong><?php echo apply_filters( 'the_title', $term->name ); ?></strong> right now. Check back later, something is bound to happen soon.</p>
</div>
</div>
<?php endif; ?>
</div><!--// end .primary-content -->
<div class="secondary-content">
<?php get_sidebar(); ?>
</div><!--// end .secondary-content -->
<?php get_footer(); ?>
tandard is not actually a post format. When no specific format is set, wordpress will assign Standard to that post. This is what you will see in the back end in post editor. If you need to exclude all other post types and just display something specific that has no post format assigned to it you will use false == has_post_format() For example
if ( false == has_post_format()) {
<--show post without a post format-->
}

3 column layout wordpress (3 posts on a page)

My client wants to have his news page with 3 columns and 3 posts on the page.
Each column has a title name, date, the excerpt and read more function.
Like this: http://rikvandoorn.nl/nieuws_pagina.jpg
Cause my PHP knowledge isn't that good, i was looking for some tutorials to create the 3 column page. But al those tutorials are outdated, in lack of information or they don't seem to work that well.
And the "leave a reply" can be moved to the single.php.
So i hope some of you can provide me some help.
This is my current content.php
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="aside">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
</div><!-- .aside -->
<footer class="entry-meta">
<?php echo get_the_date(); ?>
<?php if ( comments_open() ) : ?>
<div class="comments-link">
<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
</div><!-- .comments-link -->
<?php endif; // comments_open() ?>
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</footer><!-- .entry-meta -->
</article><!-- #post -->
Set up the wordpress loop
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="aside">
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentytwelve' ) ); ?>
</div><!-- .entry-content -->
</div><!-- .aside -->
<?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
</article><!-- #post -->
<?php endwhile; endif; wp_reset_query(); ?>
and then in the admin go to Settings > General > Reading - select 3 in 'Blog pages show at most'

Categories