Category Like layout for latest posts

January 2013 WordPress Theme
GK User
Fri Feb 15, 2013 5:29 pm
How can I get category page like layout for latest post page?
User avatar
Senior Boarder

GK User
Sat Feb 16, 2013 1:06 am
Hi,

In this case you will have to enforce displaying the full post content on the category pages. In this case you have to open all content-*.php files and change two fragments:

Code: Select all
<?php if ( is_search() || is_archive() || is_tag() ) : ?>
<section class="summary">
   <?php the_excerpt(); ?>
         
   <a href="<?php echo get_permalink(get_the_ID()); ?>" class="btn"><?php _e('Read more', GKTPLNAME); ?></a>
</section>
<?php else : ?>


to:
Code: Select all
<?php if (!is_category() && (is_search() || is_archive() || is_tag())) : ?>
<section class="summary">
   <?php the_excerpt(); ?>
         
   <a href="<?php echo get_permalink(get_the_ID()); ?>" class="btn"><?php _e('Read more', GKTPLNAME); ?></a>
</section>
<?php else : ?>


and:
Code: Select all
<?php if(is_single()) : ?>
   <?php the_content(); ?>
<?php else : ?>
   <?php the_content( __( 'Continue reading &rarr;', GKTPLNAME ) ); ?>
<?php endif; ?>


to:

Code: Select all
<?php if(is_single() || is_category()) : ?>
   <?php the_content(); ?>
<?php else : ?>
   <?php the_content( __( 'Continue reading &rarr;', GKTPLNAME ) ); ?>
<?php endif; ?>
User avatar
Administrator

GK User
Sat Feb 16, 2013 5:58 am
I don't want to show full content either on category page or on latest posts page.
The present category page just show excerpt and I want the same layout for latest post page.
Let me know if that can be done.
User avatar
Senior Boarder

GK User
Sat Feb 16, 2013 12:17 pm
Sorry I have understand it the reverse concept :) In this case you have to open the content-*.php files and change:

Code: Select all
<?php if ( is_search() || is_archive() || is_tag() ) : ?>
<section class="summary">
   <?php the_excerpt(); ?>
         
   <a href="<?php echo get_permalink(get_the_ID()); ?>" class="btn"><?php _e('Read more', GKTPLNAME); ?></a>
</section>
<?php else : ?>


to:
Code: Select all
<?php if (is_page_template('template.latest.php') || is_search() || is_archive() || is_tag() ) : ?>
<section class="summary">
   <?php the_excerpt(); ?>
         
   <a href="<?php echo get_permalink(get_the_ID()); ?>" class="btn"><?php _e('Read more', GKTPLNAME); ?></a>
</section>
<?php else : ?>
User avatar
Administrator

GK User
Tue Feb 19, 2013 8:32 am
It's not working for me, I still see full post on the latest posts page. Also, the layout is not like the category page.
User avatar
Senior Boarder

GK User
Tue Feb 19, 2013 9:30 am
Sorry, I forgot that the conditional tags like is_page() or is_page_template() doesn't work inside the Loop.

In this case please open the content.php file and edit line:

Code: Select all
<?php if (is_search() || is_archive() || is_tag() ) : ?>


to:

Code: Select all
<?php if ($tpl->isLatestPosts || is_search() || is_archive() || is_tag() ) : ?>


and please open layouts/header.php file and change lines:

Code: Select all
// create an access to the template main object
global $tpl;


to:

Code: Select all
// create an access to the template main object
global $tpl;
// set the flag for the latest posts page template
$tpl->isLatestPosts = is_page_template('template.latest.php');


It is working fine for me on my local installation.
User avatar
Administrator

GK User
Tue Feb 19, 2013 9:50 am
Still not working. I am seeing the same thing.
On category page, there is a read more button and a line between every post.
I can still see the full post on the latest post page with no read more button and no line in between the posts.
User avatar
Senior Boarder

GK User
Tue Feb 19, 2013 10:20 am
Sorry but you have to do something wrong - this solution must work, because I've tested it on the News theme installation.
User avatar
Administrator

GK User
Tue Feb 19, 2013 10:39 am
Now am getting it, however, the only thing I am getting is the Read more button,

I can't see a divider between every posts,

And also no feature image. But this feature image issue might be because of this https://www.gavick.com/forums/news-wp/f ... 22465.html though am not sure about it.
User avatar
Senior Boarder

GK User
Tue Feb 19, 2013 1:01 pm
Sorry but I cannot take this on board, because I don't see your page and configuration - all my tips are connected with the original files, if you have added your own adjustments, then you have to analyze theirs influence on other modifications.

As I wrote earlier - my code is 100% working and tested.
User avatar
Administrator

GK User
Tue Feb 19, 2013 1:49 pm
Do I have to make any changes in this template.latest.php
As I am using this page template.
User avatar
Senior Boarder

GK User
Tue Feb 19, 2013 2:45 pm
Did you modified some files in the theme? Especially the ones connected with content display?
User avatar
Administrator

GK User
Wed Feb 20, 2013 8:43 am
Yes, but am working on that. Will revert back once I am back to the original files.
User avatar
Senior Boarder

GK User
Tue Mar 05, 2013 8:10 am
I tried what you suggested on the original files. But I am not getting the divider below the "read more"
User avatar
Senior Boarder

GK User
Tue Mar 05, 2013 9:28 am
Please open the template.css file and find the following selectors:

Code: Select all
.tag-page article,
.category-page article,
.search-page article,
.archive-page article,
.author-page article


and change it to:

Code: Select all
.tag-page article,
.category-page article,
.search-page article,
.archive-page article,
.author-page article,
.page-template-template-latest-php article


it should add necessary dividers.
User avatar
Administrator


cron