- This topic is empty.
-
AuthorPosts
-
December 31, 2014 at 7:55 am #191948
AnniS
ParticipantHello all,
It would be great if someone could help me with my school project. I just can’t figure out what to do over here:
I’d like to show posts author etc. information already in the first page, as it’s shown on a post page (http://opiskelijablogi.annisalo.net/2014/12/moikka-maailma/). At the moment posts in the first page look like this: http://opiskelijablogi.annisalo.net. I want to have that row “Julkaissut Anni Salo 19.12.2014 kategoriassa Yleinen • 2 kommenttia” to show already in the first page just right below the header of a post.
Kindly let me know if you need any other information.
Many, many thanks for your help already in advance.
And happy new year! :)January 2, 2015 at 4:29 am #192055AnniS
ParticipantI have tried to add this from content-header.php:
<?php
$display_author = $bavotasan_theme_options[‘display_author’];
if ( $display_author )
printf( __( ‘Julkaissut %s’, ‘arcade’ ),
‘‘ . get_the_author() . ‘‘
);$display_date = $bavotasan_theme_options[‘display_date’];
if( $display_date ) {
if( $display_author )
echo ‘ ‘ . __( ”, ‘arcade’ ) . ‘ ‘;$display_categories = $bavotasan_theme_options[‘display_categories’];
if( $display_categories ) {
if( $display_author || $display_date )
echo ‘ ‘ . __( ‘kategoriassa’, ‘arcade’ ) . ‘ ‘;the_category( ‘, ‘ );
}$display_comments = $bavotasan_theme_options[‘display_comment_count’];
if( $display_comments && comments_open() ) {
if ( $display_author || $display_date )
echo ‘ • ‘;comments_popup_link( __( ‘0 kommenttia’, ‘arcade’ ), __( ‘1 kommentti’, ‘arcade’ ), __( ‘% kommenttia’, ‘arcade’ ) );
}
?>to content.php but all I get is a blank row in front page under the posts header (it’s now there). When I add text to content.php below the posts header, it shows also the text in post page (there’s now example). Nonetheless, it doesn’t show that blank row (nor publication information as a double) in the post page.
Is it possible that somewhere is command to not to show that particular info row in front page?
January 5, 2015 at 1:23 pm #192297Alen
ParticipantDisplay author etc. in front page
Front page as in Home Page? Page Template? Read over WordPress Template Hierarchy and make sure you’re editing the right template.
List of Template Tags that you can use. And here’s a sample code.
<?php $post_author = get_the_author(); $post_date = get_the_date(); echo '<p>Published on: '.$post_date.' by '.$post_author.'</p>'; ?>
or (both produce same results)
<p>Published on: <?php the_date(); ?> by <?php the_author(); ?></p>
Hope that helps,
-AlenJanuary 8, 2015 at 5:24 am #192629AnniS
ParticipantI’m not sure about that, I’ll try to check it. :D
If I put one of those example codes, it’s ok in the first page, but then I have publication information twice in the post page.
January 8, 2015 at 6:20 am #192634AnniS
ParticipantYAYYY, I solved it! I just had to move following code
<?php if ( ! is_front_page() || 1 < $paged ) { ?>
after the publication information code – previously it was before it.
It was too simple :)
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.