WordPress.org

Ready to get started?Download WordPress

Forums

Blaskan
Can excerpts be enabled on your theme? (11 posts)

  1. imstash
    Member
    Posted 2 years ago #

    Hi there,

    I will like to know is it possible to have excerpts enabled in your plugin? I wanted to have excerpts on the home page and the categories.

    http://wordpress.org/extend/themes/blaskan/

  2. Per Sandström
    Member
    Theme Author

    Posted 2 years ago #

    You'd have to use a child theme for that (more on how and why to use a child theme).

  3. Inserat
    Member
    Posted 2 years ago #

    This is probably the most awesome theme ever! Thank you, Per!

    However, can anyone please point out exactly how one can achieve post excerpts on the front page, rather than full posts? Any help would be greatly appreciated!

    http://wordpress.org/extend/themes/blaskan/

  4. Per Sandström
    Member
    Theme Author

    Posted 2 years ago #

    Thanks Voxpress!

    1. Create a child theme
    2. Copy all the contents of loop.php in Blaskan to a file called loop-index.php in your child theme
    3. In loop-index.php replace the code on line 51 as described below

    Replace this:

    <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'blaskan' ) ); ?>

    With this:

    <?php if ( is_front_page() ): ?>
    	<?php the_excerpt(); ?>
    <?php else: ?>
    	<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'blaskan' ) ); ?>
    <?php endif; ?>
  5. Inserat
    Member
    Posted 2 years ago #

    I replaced this as per your instructions. However, now the body text in each post is shown twice within the same post, on both the front page and on single post pages.

    Screenshot: http://f.cl.ly/items/160X0J3y2F1S021i0P0L/doubletextinsidesinglepost.png

    Thanks again, Per!

    VP

  6. Inserat
    Member
    Posted 2 years ago #

    Please disregard my previous reply, I forgot to properly comment out the original code before adding the modified one :)

  7. vanessachin
    Member
    Posted 2 years ago #

    Hello, thanks Per for this awesome theme!
    I have created a child theme and am trying to personalize it.
    Is it possible to have the full first post on the front page and then post excerpts from the 2 post onwards?
    Thanks!
    http://www.naiflove.com (still in construction!)

  8. oolongtea
    Member
    Posted 2 years ago #

    Many thanks Per for this brilliant theme! It´s the best!

    ..and Hi vanessachin! You addressed Per and I believe he soon will give you an answer. However - I would like to take the opportunity to share my solution and at the same time ask anyone for comments on it since I believe there is a smoother solution.

    I did the above thing to line 51 with a few additions:

    <?php if ( is_front_page() && ( count( get_the_category() ) )): ?>
    	<? $thecategories = get_the_category_list( ', ' );
    	$pos = strpos($thecategories,'no_excerpt'); ?>
    	<?php if ($pos == true) : ?>
    		<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'blaskan' ) ); ?>
    	<?php else: ?>
    		<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'blaskan' ), the_title_attribute( 'echo=0' ) ); ?>">
    			<?php the_excerpt(); ?>
    		</a>
    	<?php endif; ?>
    <?php else: ?>
    	<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'blaskan' ) ); ?>
    <?php endif; ?>

    then i did someting similar to what used to be line 56-58. I replaced this:

    <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'blaskan' ), the_title_attribute( 'echo=0' ) ); ?>">
    	<?php _e( 'Continue reading <span class="meta-nav">→</span>', 'blaskan' ); ?>
    </a>

    with this:

    <?php if ( is_front_page() && ( count( get_the_category() ) )): ?>
    	<? $thecategories = get_the_category_list( ', ' );
    	$pos = strpos($thecategories,'no_excerpt'); ?>
    	<?php if ($pos == true) : ?>
    		<?php //nothing ?>
    	<?php else: ?>
    		<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'blaskan' ), the_title_attribute( 'echo=0' ) ); ?>">
    		<?php _e( 'Continue reading <span class="meta-nav">→</span>', 'blaskan' ); ?>
    		</a>
    	<?php endif; ?>
    <?php else: ?>
    	<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'blaskan' ), the_title_attribute( 'echo=0' ) ); ?>">
    		<?php _e( 'Continue reading <span class="meta-nav">→</span>', 'blaskan' ); ?>
    	</a>
    <?php endif; ?>

    On the front page all posts that are assigned to the category "no_excerpt" are fully displayed.

  9. oolongtea
    Member
    Posted 2 years ago #

    Comment on my post above - "& rarr;" in the code snippets was not supposed to be replaced by a little arrow "→". I don´t know why that happened. Remove the space after the "&" to get it right.

  10. www.guylarge.com
    Member
    Posted 1 year ago #

    Is there any chance excerpts can be enabled as an option in the main theme?

    I really like the theme itself but one of my reasons for using a theme in the first place rather than coding my own site is that I want to focus my time on content rather than programming e.g. learning how to personalise and install a child theme.

  11. www.guylarge.com
    Member
    Posted 1 year ago #

    I've managed to solve this problem by installing the Auto Excerpt anywhere plugin, which provides excerpts without me having to learn how to play with child themes.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic

Tags