• Resolved saroshwaiz

    (@saroshwaiz)


    Hello Everyone,

    I need help in sorting out this issue. I am not very familiar to php .. but do know a little bit about it.

    I want to bring my post title and the author name along with the date and time in the same line. Everything in one line. But I cannot resolve this issue. Can anyone tell me if this is possible?

    After I am done with that, I also need to define a limit to the characters of the post title. Please check my website link at: http://www.loungepk.com

    The following is the code that I am not able to understand and modify to do the above:

    <?php get_header(); ?>

    <div id=”content”>

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php previous_post_link(‘« %link’) ?></div>
    <div class=”alignright”><?php next_post_link(‘%link »’) ?></div>
    </div><div style=”clear:both”> </div>
    <div <?php post_class(); ?> id=”post-<?php the_ID(); ?>”>
    <h2 class=”posttitle”><?php the_title(); ?></h2>
    <div class=”postmetadata”>
    <?php if(f2_option(‘show_author’) == ‘on’) : ?>
    <?php _e(‘Posted by’, ‘f2’); ?> <span class=”postauthor”><?php the_author_posts_link(); ?></span> <?php _e(‘on’, ‘f2’); ?>
    <?php endif; ?>
    <span class=”postdate”><?php the_time(__(‘j F Y, g:i a’, ‘f2’)); ?></span>
    </div>
    <div class=”postentry”>
    <?php the_content(); ?>
    <?php wp_link_pages(array(‘before’ => ‘<p>‘.__(‘Pages:’, ‘f2′).’ ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>
    </div>

    <div class=”postmetadata”>
    <div class=”posttagscat”>
    <?php if(f2_option(‘show_cat’) == ‘on’) : ?>
    <span class=”postcat”><?php _e(‘Filed under’, ‘f2’); ?> <?php the_category(‘, ‘); ?></span>
    <?php endif; ?>
    <?php if( function_exists(‘the_tags’) )
    the_tags(‘<span class=”posttags”>’.__(‘Tagged’, ‘f2′).’ ‘, ‘, ‘, ‘</span>’);
    ?>
    </div>
    <span class=”postcomment”><?php if(comments_open()) { ?><?php _e(‘Comment’, ‘f2’) ?> (<?php comments_rss_link(‘RSS’); ?>)<?php } else _e(‘Comments are closed’, ‘f2’); ?>
    <?php if(pings_open()) { ?> |   ” rel=”trackback”><?php _e(‘Trackback’, ‘f2’) ?><?php } ?>
    </span>
    <span class=”permalink”> |  ” rel=”bookmark” title=”<?php printf(__(‘Permanent Link to %s’, ‘f2’), the_title_attribute(‘echo=0’)); ?>”>Permalink</span>
    <?php edit_post_link(__(‘Edit’, ‘f2’), ‘<span class=”postedit”>’, ‘</span>’); ?>
    </div>
    </div>
    <?php comments_template(); ?>

    <?php endwhile; ?>

    <div class=”navigation”>
    <div class=”alignleft”><?php previous_post_link(‘« %link’) ?></div>
    <div class=”alignright”><?php next_post_link(‘%link »’) ?></div>
    </div>

    <?php else: ?>

    <div class=”post”>
    <h2 class=”posttitle”><?php _e(‘Not Found’, ‘f2’) ?></h2>
    <div class=”postentry”><p><?php _e(‘Sorry, no posts matched your criteria.’, ‘f2’); ?></p></div>
    </div>

    <?php endif; ?>

    </div>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Please help me out :(…

    Thanks,
    SW

Viewing 3 replies - 1 through 3 (of 3 total)
  • hello, saroshwaiz, you have to do some CSS modification not the code php.

    Probably, add the following css rule would make it work.

    .posttitle,
    .postmetadata {
    display:inline;
    }

    to limit your title length, you can replace the function the_title()
    by this one:

    function the_title_limit($length) {
    	if (strlen(the_title($before = '', $after = '', FALSE)) > $length) {
    		echo substr(the_title($before = '', $after = '', FALSE), 0, $length) . '...';
    	}
    	else the_title();
    }

    where $length is your preferred title length.

    Thread Starter saroshwaiz

    (@saroshwaiz)

    WOW!! Thanks so much hedonplay! It worked 😀 … thanks so much!! :D:D:D

    You are welcome saroshwaz.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Post Title & Author Name Problem :(’ is closed to new replies.