Topic: [SOLVED] Adding Category Name to Quick Preview

Hello all,

I'd like to tweak my "Quick Previews" a bit:

1) Remove the transparent block from the thumbnail which shows date and comment count;

2) Add category name and date to the right, next to the excerpt.

I've searched at the forums and someone wrote that there's supposed to be a "tapestries.php" in /library where the coding for "Quick Preview" is located? I don't have such a file there though.

My version of Arras is 1.3.6.

Last edited by Ottens (2010-08-01 11:26:59)

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Tapestries.php is not in 1.3.6, 1.3.6 works from template.php to assign how looks what.

My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: [SOLVED] Adding Category Name to Quick Preview

I see. I'm having some difficulty identifying just the code I need though.

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Anyone know where it is? Please?  smile

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Sorry to bump this again, but I could really use some help. I'm afraid I'm not much good at PHP coding.

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

problem is we don't have that version  (1.3.6) ,,, can you copy and paste here the code you want to edit.... or even better if  you have a download link in your site to the version of arras you are using, so we can work on it???

we got more than what we are giving back....

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

You do know there's a download archive, right?

http://www.arrastheme.com/release-archive/

My Arras themed & Arras related site: NullCore.
Please ask questions about Arras on forum, not through mail, thanks.

Re: [SOLVED] Adding Category Name to Quick Preview

didn't know man, thanks ...

we got more than what we are giving back....

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

@ ottens

here you have the code need to achieve what you want.....

1- open template.php, look for this lines of code >>

function arras_get_posts($page_type, $query = null) {
    global $post, $wp_query;
    if (!$query) $query = $wp_query;
    if ( $query->have_posts() ) : ?>

<?php if (arras_get_option($page_type . '_news_display') == 'traditional') : ?>
    <div class="traditional hfeed">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <div <?php arras_single_post_class() ?>>
        <?php arras_postheader() ?>
        <div class="entry-content"><?php the_content( __('<p>Read the rest of this entry &raquo;</p>', 'arras') ); ?></div>
        <?php arras_postfooter() ?>
    </div>
    <?php endwhile; ?>
    </div><!-- .traditional -->
<?php elseif (arras_get_option($page_type . '_news_display') == 'line') : ?>
    <ul class="hfeed posts-line clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
    
        <?php if(!is_archive()) : ?>
        <span class="entry-cat">
            <?php $cats = get_the_category(); 
            if (arras_get_option('news_cat')) echo $cats[1]->cat_name;
            else echo $cats[0]->cat_name; ?>
        </span>
        <?php endif ?>
        
        <h3 class="entry-title"><a rel="bookmark" href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'arras'), get_the_title() ) ?>"><?php the_title() ?></a></h3>
        <span class="entry-comments"><?php comments_number() ?></span>
    </li>
    <?php endwhile; ?>
    </ul>
<?php else : ?>
    <ul class="hfeed posts-<?php echo arras_get_option($page_type . '_news_display') ?> clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
        <?php arras_newsheader($page_type) ?>
        <div class="entry-summary"><?php echo arras_strip_content(get_the_excerpt(), 20); ?></div>
<?php arras_newsfooter($page_type) ?>        
    </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>

<?php endif; ?>

<?php
}

2- replace it with this one>>

function arras_get_posts($page_type, $query = null) {
    global $post, $wp_query;
    if (!$query) $query = $wp_query;
    if ( $query->have_posts() ) : ?>

<?php if (arras_get_option($page_type . '_news_display') == 'traditional') : ?>
    <div class="traditional hfeed">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <div <?php arras_single_post_class() ?>>
        <?php arras_postheader() ?>
        <div class="entry-content"><?php the_content( __('<p>Read the rest of this entry &raquo;</p>', 'arras') ); ?></div>
        <?php arras_postfooter() ?>
    </div>
    <?php endwhile; ?>
    </div><!-- .traditional -->
<?php elseif (arras_get_option($page_type . '_news_display') == 'line') : ?>
    <ul class="hfeed posts-line clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
    
        <?php if(!is_archive()) : ?>
        <span class="entry-cat">
            <?php $cats = get_the_category(); 
            if (arras_get_option('news_cat')) echo $cats[1]->cat_name;
            else echo $cats[0]->cat_name; ?>
        </span>
        <?php endif ?>
        
        <h3 class="entry-title"><a rel="bookmark" href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'arras'), get_the_title() ) ?>"><?php the_title() ?></a></h3>
        <span class="entry-comments"><?php comments_number() ?></span>
    </li>
    <?php endwhile; ?>
    </ul>
<?php else : ?>
    <ul class="hfeed posts-<?php echo arras_get_option($page_type . '_news_display') ?> clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
        <?php arras_newsheader($page_type) ?>
        <div class="entry-summary"><?php echo arras_strip_content(get_the_excerpt(), 20); ?></div>
<!-- here i add this lines to show category name and the puplish date-->
<span class="holder"><a href="<?php echo get_permalink(); ?>">
<span class="category"><span class="cat">Posted in:</span>
<?php if ( arras_get_option('post_cats') ) {
            $post_cats = array();
            $cats = get_the_category();
            foreach ($cats as $c) $post_cats[] = $c->cat_name;
            echo sprintf( __('%s', 'arras'), implode(' , ', $post_cats) );} ?></span></a>
<abbr class="date" title="<?php echo get_the_time('c'); ?>">Date: <?php echo get_the_time( get_option('  date_format') ); ?></abbr></span>
<!-- end of my added code-->
<?php arras_newsfooter($page_type) ?>        
    </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>

<?php endif; ?>

<?php
}

3- open your filter.php file and look for this lines>>

/**
 * Called to display post heading for news in index and archive pages
 * @since 1.2.2
 */
function arras_newsheader($page_type) {
    global $post;
    $postheader = '';
    
    if ( arras_get_option('layout') == '3c-r-fixed' || arras_get_option('layout') == '3c-fixed' ) {
        $w = ARRAS_3COL_MINI_WIDTH;
        $h = ARRAS_3COL_MINI_HEIGHT;
    } else {
        $w = ARRAS_2COL_MINI_WIDTH; 
        $h = ARRAS_2COL_MINI_HEIGHT;
    }
    
    $postheader .= '<div class="entry-thumbnails"><a class="entry-thumbnails-link" href="' . get_permalink() . '">';
    
    if ( ($thumbnail = arras_get_thumbnail($w, $h)) ) {
        $postheader .= '<img src="' . arras_get_thumbnail($w,$h) . '" alt="' . get_the_title() . '" title="' . get_the_title()    . '" />';
    } else {
        $postheader .= get_the_title();
    }
   $postheader .= '<span class="entry-meta"><a href="' . get_permalink() . '"><span class="entry-comments">' . get_comments_number() . '</span></a>';
   $postheader .= '<abbr class="published" title="' . get_the_time('c') . '">' . get_the_time( get_option('date_format') ) . '</abbr></span></div>';
    
    $postheader .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
    
    echo apply_filters('arras_newsheader', $postheader);
}

5-replace it with lines>>

/**
 * Called to display post heading for news in index and archive pages
 * @since 1.2.2
 */
function arras_newsheader($page_type) {
    global $post;
    $postheader = '';
    
    if ( arras_get_option('layout') == '3c-r-fixed' || arras_get_option('layout') == '3c-fixed' ) {
        $w = ARRAS_3COL_MINI_WIDTH;
        $h = ARRAS_3COL_MINI_HEIGHT;
    } else {
        $w = ARRAS_2COL_MINI_WIDTH; 
        $h = ARRAS_2COL_MINI_HEIGHT;
    }
    
    $postheader .= '<div class="entry-thumbnails"><a class="entry-thumbnails-link" href="' . get_permalink() . '">';
    
    if ( ($thumbnail = arras_get_thumbnail($w, $h)) ) {
        $postheader .= '<img src="' . arras_get_thumbnail($w,$h) . '" alt="' . get_the_title() . '" title="' . get_the_title()    . '" />';
    } else {
        $postheader .= get_the_title();
    }
    // here i removed some lines that shows the post date and comments on the thumbnail

    $postheader .= '</a>';
    $postheader .= '</div>';
    
    $postheader .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
    
    echo apply_filters('arras_newsheader', $postheader);
}

6- add this to your style sheet(user.css)>>>

 .holder {
background-color:#000000;
-moz-border-radius:8px 8px 8px 8px;
    color:#030303;
    display:block;
    float:right;
    height:auto;
        min-height:30px;
    margin:6px 0 0 0;
    opacity:0.7;
    vertical-align:baseline;
    width:120px;
    z-index:9999;
    text-align: center;
    font-size: 11px;
    border:2px solid #0052A3;
    padding:3px;
}
 .holder:hover {
    opacity:1;
    width:130px;
}
.holder .category {
text-align: left;
margin:1px;
padding:0px;
    display:inline-block;
}
.holder .cat {
color:#00C100;
text-align: left;
margin:1px;
padding:0px;
font-size: 11px;
display:inline-block;
}
.holder .date {
text-align: center;
color:#cccccc;
padding:0px;
margin-top:1px;
vertical-align:baseline;
display:inline-block;
}    
we got more than what we are giving back....

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

son_azules, that worked like a charm! I'll have to do a bit of editing in CSS but that I can do.  wink 

Thank you so much for your help!  big_smile

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Oh! I spoke a little too soon perhaps: it also changes the nod based view on tag and category archive pages. Is there a way to do it just for the "Quick Preview", which I only use on the front page?

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

hahahaha....

yes actually it change the node based view also .... the theme doesn't separate between "quick preview" and "node based view."..

the only solution is to update your theme.....

we got more than what we are giving back....

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Ottens wrote:

Oh! I spoke a little too soon perhaps: it also changes the nod based view on tag and category archive pages. Is there a way to do it just for the "Quick Preview", which I only use on the front page?

this time don't speak too soon ok..... lol

i managed to separate  between the quick and node view.. so you will have no problem at all.. try it and reply back ( and mark this topic as solved ok).

replace the code you add before with new ones >>>

1- template.php >>>

function arras_get_posts($page_type, $query = null) {
    global $post, $wp_query;
    if (!$query) $query = $wp_query;
    if ( $query->have_posts() ) : ?>

<?php if (arras_get_option($page_type . '_news_display') == 'traditional') : ?>
    <div class="traditional hfeed">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <div <?php arras_single_post_class() ?>>
        <?php arras_postheader() ?>
        <div class="entry-content"><?php the_content( __('<p>Read the rest of this entry &raquo;</p>', 'arras') ); ?></div>
        <?php arras_postfooter() ?>
    </div>
    <?php endwhile; ?>
    </div><!-- .traditional -->
<?php elseif (arras_get_option($page_type . '_news_display') == 'line') : ?>
    <ul class="hfeed posts-line clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
    
        <?php if(!is_archive()) : ?>
        <span class="entry-cat">
            <?php $cats = get_the_category(); 
            if (arras_get_option('news_cat')) echo $cats[1]->cat_name;
            else echo $cats[0]->cat_name; ?>
        </span>
        <?php endif ?>
        
        <h3 class="entry-title"><a rel="bookmark" href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'arras'), get_the_title() ) ?>"><?php the_title() ?></a></h3>
        <span class="entry-comments"><?php comments_number() ?></span>
    </li>
    <?php endwhile; ?>
    </ul>
<?php else : ?>
    <ul class="hfeed posts-<?php echo arras_get_option($page_type . '_news_display') ?> clearfix">
    <?php while ($query->have_posts()) : $query->the_post() ?>
    <li <?php arras_post_class() ?>>
        <?php arras_newsheader($page_type) ?>
        <div class="entry-summary"><?php echo arras_strip_content(get_the_excerpt(), 20); ?></div>
<!-- here i add this lines to show category name and the puplish date-->
<?php if (arras_get_option($page_type . '_news_display') == 'quick') : ?>
<span class="holder">
<span class="category"><span class="cat">Posted in:</span>
<?php if ( arras_get_option('post_cats') ) {
$post_cats = array();
            $cats = get_the_category();
            foreach ($cats as $c) $post_cats[] = '<a href="' . get_category_link($c->cat_ID) . '">' . $c->cat_name . '</a>';
            echo sprintf( __('%s', 'arras'), implode(' , ', $post_cats) );} ?></span>
<abbr class="date" title="<?php echo get_the_time('c'); ?>">Date: <?php echo get_the_time( get_option('  date_format') ); ?></abbr></span>
<?php endif; ?>
<!-- end of my added code-->
<?php arras_newsfooter($page_type) ?>        
    </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>

<?php endif; ?>

<?php
}

2- filters.php code>>>

/**
 * Called to display post heading for news in index and archive pages
 * @since 1.2.2
 */
function arras_newsheader($page_type) {
    global $post;
    $postheader = '';
    
    if ( arras_get_option('layout') == '3c-r-fixed' || arras_get_option('layout') == '3c-fixed' ) {
        $w = ARRAS_3COL_MINI_WIDTH;
        $h = ARRAS_3COL_MINI_HEIGHT;
    } else {
        $w = ARRAS_2COL_MINI_WIDTH; 
        $h = ARRAS_2COL_MINI_HEIGHT;
    }
    
    $postheader .= '<div class="entry-thumbnails"><a class="entry-thumbnails-link" href="' . get_permalink() . '">';
    
    if ( ($thumbnail = arras_get_thumbnail($w, $h)) ) {
        $postheader .= '<img src="' . arras_get_thumbnail($w,$h) . '" alt="' . get_the_title() . '" title="' . get_the_title()    . '" />';
    } else {
        $postheader .= get_the_title();
    }
    // here i removed this lines that shows the post date and comments on the thumbnail
    if (arras_get_option($page_type . '_news_display') == 'quick'){
    $postheader .= '</a>';
    $postheader .= '</div>';
    }else {
    $postheader .= '</a>';
    $postheader .= '<span class="entry-meta"><a href="' . get_permalink() . '"><span class="entry-comments">' . get_comments_number() . '</span></a>';
    $postheader .= '<abbr class="published" title="' . get_the_time('c') . '">' . get_the_time( get_option('date_format') ) . '</abbr></span></div>';
    }
    
    
    $postheader .= '<h3 class="entry-title"><a href="' . get_permalink() . '" rel="bookmark">' . get_the_title() . '</a></h3>';
    
    echo apply_filters('arras_newsheader', $postheader);
}

your problem is solved

we got more than what we are giving back....

Thumbs up

Re: [SOLVED] Adding Category Name to Quick Preview

Sorry to have kept you waiting, I didn't have a chance to work on my site until today.

That works splendidly! Thanks for your help, son_azules! It's much appreciated  smile

Thumbs up