Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Excerpts, Read more, Pagination (http://forum.bytesforall.com/forumdisplay.php?f=20)
-   -   how to? Given category always show the complete post instead of the excerpt? (http://forum.bytesforall.com/showthread.php?t=13555)

daniel3ub Mar 29, 2011 05:13 PM

how to? Given category always show the complete post instead of the excerpt?
 
Hi, guys!

Is there a way to make the posts from a given category always show the complete post instead of the excerpt, while all others categories showing the excerpt? I want to do this in the home and all other pages, not only in the given category page.

Thanks!

daniel3ub Apr 6, 2011 06:46 PM

Ok, an update.

I know I have to insert an 'if' statement into the loop, that will check if the post is from the given category.

My question is: should I edit the index.php (and exactly where I could put this) or I can use this if into the loop options in ATO?

Thanks!

juggledad Apr 7, 2011 05:31 AM

you will want to edit bfa_postparts.php and look at the 'function bfa_post_bodycopy'

daniel3ub Apr 16, 2011 07:33 PM

I am testing the following in the loop section in Atahualpa options:

Just below the line
PHP Code:

<div class="<?php echo ( is_page() ? 'page ' '' ) . $odd_or_even ' post" id="post-'the_ID(); ?>">
<?php ?>

I inserted the following:
PHP Code:

<?php // make posts from category 49 always Full
$cat_loop get_the_category(get_the_ID());
$cat_loop_zero $cat_loop[0]->cat_ID;
if (
$cat_loop_zero == 49) {
$bfa_ata[excerpts_home] = 'Full Posts'; } ?>

Then, just before the closing </div>:
PHP Code:

<?php $bfa_ata[excerpts_home] = 'Only Excerpts'?>

My "Loop" section for ATO is then:

PHP Code:

<?php /* Post Container starts here */
if ( function_exists('post_class') ) { ?>
<div <?php if ( is_page() ) { post_class('post'); } else { post_class("$odd_or_even"); } ?> id="post-<?php the_ID(); ?>">
<?php } else { ?>
<div class="<?php echo ( is_page() ? 'page ' '' ) . $odd_or_even ' post" id="post-'the_ID(); ?>">
<?php ?>

<?php // make posts from category 49 always Full
$cat_loop get_the_category(get_the_ID());
$cat_loop_zero $cat_loop[0]->cat_ID;
if (
$cat_loop_zero == 49) {
$bfa_ata[excerpts_home] = 'Full Posts'; } ?>

<?php bfa_post_kicker('<div class="post-kicker"><?php get_cat_icon(); ?>','</div>'); ?>
<?php bfa_post_headline
('<div class="post-headline">','</div>'); ?>

<?php bfa_post_byline('<div class="post-byline">','</div>'); ?>
<?php bfa_post_bodycopy
('<div class="post-bodycopy clearfix">','</div>'); ?>

<?php bfa_post_pagination('<p class="post-pagination"><strong>'.__('Pages:','atahualpa').'</strong>','</p>'); ?>

<?php bfa_post_footer('<div class="post-footer">','</div>'); ?>

<?php $bfa_ata[excerpts_home] = 'Only Excerpts'?>
</div><!-- / Post -->

It seems to work (it's not in the production server yet, but working in my testing environment), and I don't need to mess with the theme's files.

Anything wrong with this approach?

gigabrian Jun 20, 2012 06:54 PM

Hi,

Did this code work in the end?

I am attempting to due the same thing. I'm basically treating a "news" category page as separate to the rest of the blog, and I want to show full posts on this category page while the rest of the blog displays excerpts. I had a look at the code above and as best I can tell bfa_post_parts.php is perhaps different in newer versions of Atahualpa.

I could really use help to set up showing full posts in this category. I'm a bit of a noob/newb, I don't know much about php and I don't even have FTP access for the site I'm working on, so if I cause a parse error I'm in real trouble.

Thanks.

lmilesw Jun 21, 2012 06:43 AM

Another option to editing the theme files is to use the List Category Posts plugin which uses a shortcode with attributes you can set to show a particular category and full posts or excerpts or just about anything you want.

juggledad Jun 21, 2012 07:51 AM

Quote:

I don't know much about php and I don't even have FTP access for the site I'm working on, so if I cause a parse error I'm in real trouble.
if you don't know what you are doing and don't have FTP access, you should not touch the files

markzip Jul 9, 2012 05:25 PM

Larry,
I don't understand how List Category Posts might work for me in this case.
I too am trying to make The "category" page for a given category display the entire post filed under that category. (I am using categories as navigation and there is only one post associated with this category)
But, when I have used List Category Posts before on a different site, it has been on a proper PAGE and I used it to pull in posts in a given category. I can't imagine how it is applicable here.

So I want to do what the OP wants to do, use excerpts on most category pages and if there is only one post in a given category, have that show up as a full post on the category page.

TIA

lmilesw Jul 9, 2012 08:04 PM

I know of no way to have category pages with only one post shoe the complete post. That would require some programing. I read this post fast and didn't clearly understand the need.

juggledad Jul 10, 2012 02:33 AM

Th code from post 4 would have to be added to index.php


All times are GMT -6. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.