BuilderChild-Kepler

From IThemes Codex
(Difference between revisions)
Jump to: navigation, search
(About the content and using excerpts)
 
(How to replace circular date with regular text date)
 
(7 intermediate revisions by one user not shown)
Line 1: Line 1:
 
[http://demos.ithemes.com/kepler/ Kepler Demo Site]
 
[http://demos.ithemes.com/kepler/ Kepler Demo Site]
  
= About the content and using excerpts =
+
== About the content and using excerpts ==
  
 
By default full content gets shown in Kepler listing pages like the Posts page.
 
By default full content gets shown in Kepler listing pages like the Posts page.
Line 11: Line 11:
 
</pre>
 
</pre>
  
in child theme's content.php.
+
in child theme's '''content.php'''.
  
 
To break the content and have "Read More →" appear below each post similar to the [http://demos.ithemes.com/kepler/blog/ demo Posts page], use ''more'' tag built in WordPress. i.e., by inserting <pre><!--more--></pre> wherever you want the post to split up when in HTML view of the post editor.
 
To break the content and have "Read More →" appear below each post similar to the [http://demos.ithemes.com/kepler/blog/ demo Posts page], use ''more'' tag built in WordPress. i.e., by inserting <pre><!--more--></pre> wherever you want the post to split up when in HTML view of the post editor.
  
If you would like to show excerpts instead of full content (or partial content using more tag),
+
== To show excerpts instead of full content (or partial content using more tag) ==
 +
 
 +
If your site already has a lot of posts it will be a tedious process to manually insert the ''more'' tag for each post.
 +
 
 +
The steps below helps in automatically adding "Read More →" to existing posts without having to update each individually.
  
 
'''1.''' Replace
 
'''1.''' Replace
Line 29: Line 33:
 
</pre>
 
</pre>
  
in content.php.
+
in '''content.php'''.
  
'''2.''' Add the following at the end of child theme's style.css:
+
'''2.''' Add the following at the end of child theme's '''functions.php''':
  
 
<pre class="brush:css;">
 
<pre class="brush:css;">
Line 45: Line 49:
 
Note: Formatting i.e., HTML code like ''paragraph'', ''strong'' tags will get stripped in auto excerpts. If you would like formatting to retain, use manual excerpts.
 
Note: Formatting i.e., HTML code like ''paragraph'', ''strong'' tags will get stripped in auto excerpts. If you would like formatting to retain, use manual excerpts.
  
= Item 2 =
+
== How to replace circular date with regular text date ==
 +
 
 +
[[File:Screen Shot 2012-02-21 at 1.51.16 PM.png|503px|thumb|none|Before]]
 +
 
 +
[[File:Screen Shot 2012-02-21 at 2.02.00 PM.png|658px|thumb|none|After]]
 +
 
 +
Edit child theme's content.php.
 +
 
 +
Replace
 +
 
 +
<pre class="brush:php;">
 +
<?php if ( function_exists( 'builder_child_posted_on') && ( builder_get_theme_setting( 'disable_builder_child_posted_on' ) != true ) ) : ?>
 +
<?php echo builder_child_posted_on(); ?>
 +
<?php endif; ?>
 +
</pre>
 +
 
 +
with
 +
 
 +
<pre class="brush:php;">
 +
<div class="entry-meta date"><?php echo get_the_date(); ?></div>
 +
</pre>
 +
 
 +
Do the same in content-image.php as well.
 +
 
 +
Edit child theme's single.php.
 +
 
 +
Replace
 +
 
 +
<pre class="brush:php;">
 +
<?php if ( function_exists( 'builder_child_posted_on') && ( builder_get_theme_setting( 'disable_builder_child_posted_on' ) != true ) ) : ?>
 +
<?php echo builder_child_posted_on(); ?>
 +
<?php else : ?>
 +
<div class="entry-meta date">
 +
<?php echo get_the_date(); ?>
 +
</div>
 +
<?php endif; ?>
 +
</pre>
 +
 
 +
with
 +
 
 +
<pre class="brush:php;">
 +
<div class="entry-meta date"><?php echo get_the_date(); ?></div>
 +
</pre>
  
= Item 3 =
+
== Item 3 ==
  
= Item 4 =
+
== Item 4 ==

Latest revision as of 15:06, February 21, 2012

Kepler Demo Site

Contents

About the content and using excerpts

By default full content gets shown in Kepler listing pages like the Posts page.

This is defined via

<?php the_content( __( 'Read More →', 'it-l10n-BuilderChild-Kepler' ) ); ?>

in child theme's content.php.

To break the content and have "Read More →" appear below each post similar to the demo Posts page, use more tag built in WordPress. i.e., by inserting
<!--more-->
wherever you want the post to split up when in HTML view of the post editor.

To show excerpts instead of full content (or partial content using more tag)

If your site already has a lot of posts it will be a tedious process to manually insert the more tag for each post.

The steps below helps in automatically adding "Read More →" to existing posts without having to update each individually.

1. Replace

<?php the_content( __( 'Read More →', 'it-l10n-BuilderChild-Kepler' ) ); ?>

with

<?php the_excerpt(); ?>

in content.php.

2. Add the following at the end of child theme's functions.php:

function new_excerpt_more($more) {
	global $post;
	return '<div class="readmore"><a href="'. get_permalink($post->ID) . '">Read More →</a></div>';
}
add_filter('excerpt_more', 'new_excerpt_more');
Screenshot showing a Posts page when excerpts are being used

Note: Formatting i.e., HTML code like paragraph, strong tags will get stripped in auto excerpts. If you would like formatting to retain, use manual excerpts.

How to replace circular date with regular text date

Before
After

Edit child theme's content.php.

Replace

<?php if ( function_exists( 'builder_child_posted_on') && ( builder_get_theme_setting( 'disable_builder_child_posted_on' ) != true ) ) : ?>
								<?php echo builder_child_posted_on(); ?>
							<?php endif; ?>

with

<div class="entry-meta date"><?php echo get_the_date(); ?></div>

Do the same in content-image.php as well.

Edit child theme's single.php.

Replace

<?php if ( function_exists( 'builder_child_posted_on') && ( builder_get_theme_setting( 'disable_builder_child_posted_on' ) != true ) ) : ?>
								<?php echo builder_child_posted_on(); ?>
							<?php else : ?>
								<div class="entry-meta date">
									<?php echo get_the_date(); ?>
								</div>
							<?php endif; ?>

with

<div class="entry-meta date"><?php echo get_the_date(); ?></div>

Item 3

Item 4

Personal tools
Namespaces
Variants
Actions
iThemes Codex
Codex Navigation
Toolbox