How to include posts in page without title?
-
Hi,
how can I make the excerpt of the posts on the page show the content only, but not the title of the post at the beginning? That is a bit annoying. I tried to take a look at the posts_in_page.php file but I don’t know how to correctly change it.Thanks!
-
Howdy @thaqy,
Easy peasy. Here are the steps:
Step 1
Copy the posts_loop_template.php file from the main folder of the Posts in Page plugin into your main theme folder.Step 2
Open the file you copied into your theme folder. You’ll see the following code between the<!-- Post Wrap Start-->
and<!-- Post Wrap End-->
:<div class="post hentry ivycat-post"> <!-- This outputs the post TITLE --> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <!-- This outputs the post EXCERPT. To display full content including images and html, replace the_excerpt(); with the_content(); below. --> <div class="entry-summary"> <?php the_excerpt(); ?> </div> <!-- This outputs the post META information --> <div class="entry-utility"> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> </span> <span class="meta-sep">|</span> <?php endif; ?> <?php $tags_list = get_the_tag_list( '', ', ' ); if ( $tags_list ): ?> <span class="tag-links"> <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> </span> <span class="meta-sep">|</span> <?php endif; ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span> <?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> </div> </div>
Step 3
If you wish to remove the title of the post from this template, delete the following line (it’s lines 16 & 17 in the current file):<!-- This outputs the post TITLE --> <h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
Step 4
Save and test.I hope that helps!
Eric
Hi,
thanks for your quick answer. Unfortunately that does not help. I updated the file in the plugin folder and deleted the 2 lines but the titles are still in the excerpt.Thanks in advance!
Unfortunately that does not help. I updated the file in the plugin folder and deleted the 2 lines but the titles are still in the excerpt.
First, don’t update the file in the plugin folder as it will be replaced with the next plugin update. It’s critical that you copy posts_loop_template.php to your active theme’s main folder, then edit it.
Second, once you do that, the entire posts_loop_template.php code for your edited page should look like this:
<?php /** * @package Posts_in_Page * @author Eric Amundson <[email protected]> * @copyright Copyright (c) 2017, IvyCat, Inc. * @license https://www.gnu.org/licenses/gpl-2.0.html */ ?> <!-- NOTE: If you need to make changes to this file, copy it to your current theme's main directory so your changes won't be overwritten when the plugin is upgraded. --> <!-- Post Wrap Start--> <div class="post hentry ivycat-post"> <!-- This outputs the post EXCERPT. To display full content including images and html, replace the_excerpt(); with the_content(); below. --> <div class="entry-summary"> <?php the_excerpt(); ?> </div> <!-- This outputs the post META information --> <div class="entry-utility"> <?php if ( count( get_the_category() ) ) : ?> <span class="cat-links"> <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> </span> <span class="meta-sep">|</span> <?php endif; ?> <?php $tags_list = get_the_tag_list( '', ', ' ); if ( $tags_list ): ?> <span class="tag-links"> <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'posts-in-page' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> </span> <span class="meta-sep">|</span> <?php endif; ?> <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'posts-in-page' ), __( '1 Comment', 'posts-in-page' ), __( '% Comments', 'posts-in-page' ) ); ?></span> <?php edit_post_link( __( 'Edit', 'posts-in-page' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> </div> </div> <!-- // Post Wrap End -->
Does that help?
Hi, thanks for your answer.
I just noticed there has been a misunderstanding. Removing the title did work indeed, but I actually meant something else. I was not talking about removing the title above the excerpt, I meant I’d like to remove the title of the actual excerpt.Let me give you an example. Right now the post that shall be excerpted looks like this:
Title of the post: Brandnew stuff coming soon
Content: Text text text textThe excerpt from post in page sais:
Title: Brandnew stuff coming soon
Content: Brandnew stuff coming soon Text text text textThe content of the excerpt contains the title again, and there I would like to remove it. I hope my explanation makes sense. Thanks in advance for all further hints.
Hi @thaqy,
Will you post the entire contents of your active loop template file?
If you did Step 1 above it should be in your theme folder
Step 1
Copy the posts_loop_template.php file from the main folder of the Posts in Page plugin into your main theme folder.
- The topic ‘How to include posts in page without title?’ is closed to new replies.