Forums

Previous and Next Project Links on the same line? (7 posts)

  1. brobins
    Member
    Posted 1 year ago #

    Hi all!

    I have a problem which has been driving me mad! I just cant seem to find a solution, I hope you can help..

    http://www.benrobins.com/intel-the-chase/

    If you take a look at one of the Single Posts on my site ^^ You will notice that at the bottom of the post I have added Previous and Next links to allow the user to navigate through my posts.

    This works a treat although they appear over two lines.

    What I am trying to achieve is to have these two links on the same line but remain formatted on the left and right. Is this possible?

    Here is the code I am using at the moment:

    echo $preview; // echo the preview image
    		the_content('Read more');
    		previous_post_link('<h6 style="float:right;">%link</h6>', 'Next project', TRUE); ?>
    		<?php next_post_link('<h6 style="float:left;">%link</h6>', 'Previous project', TRUE); ?>

    Many Thanks in advance!

    Ben

  2. anjali.n
    Member
    Posted 1 year ago #

    Hello,
    In the place of your code just copy the following and check it once

    [please use the 'code' button to mark any posted code]

    echo $preview; // echo the preview image
    		the_content('Read more');
    <div style="width:860px;">
    		previous_post_link('<h6 style="float:right;">%link</h6>', 'Next project', TRUE); ?>
    		<?php next_post_link('<h6>%link</h6>', 'Previous project', TRUE); ?>
    </div>

    Try it and let me know the output

    [signature moderated per forum rules]

  3. brobins
    Member
    Posted 1 year ago #

    Hi

    Thank you for your reply!

    I updated the code and got the following error...

    Parse error: syntax error, unexpected '<' in /home2/benrobin/public_html/wp-content/themes/display/display/single.php on line 58

    Many Thanks,

  4. anjali.n
    Member
    Posted 1 year ago #

    [please use the 'code button to mark any posted code]

    echo $preview; // echo the preview image
    the_content('Read more'); ?>
    <div style="width:860px;">
    <?php previous_post_link('<h6 style="float:right;">%link</h6>', 'Next project', TRUE); ?>
    <?php next_post_link('<h6>%link</h6>', 'Previous project', TRUE); ?>
    </div>

    replace with this code.You did not close the php tags properly thats why you got that message

  5. brobins
    Member
    Posted 1 year ago #

    Hi,

    Thank you for your reply.

    The I now have no errors although both links still remain on two separate lines..

    Many Thanks,

  6. brobins
    Member
    Posted 1 year ago #

    Hey,

    Ok I seem to have solved the issue by using the following code..

    echo $preview; // echo the preview image
    		the_content('Read more'); ?>
    		<div style="width:860px;">
    		<span style='float: right;'>
    		<?php previous_post_link('<h6>%link</h6>', 'Next project', TRUE); ?></span>
    		<span style='float: left;'>
    		<?php next_post_link('<h6>%link</h6>', 'Previous project', TRUE); ?></span>
    		</div>

    This is doing exactly what I want :)

    The only thing left is to add a line above the links to seperate them from the post. How could I achieve this?

    Many Thanks,

  7. anjali.n
    Member
    Posted 1 year ago #

    adding one line will separate the code from the links.for that change the code like this

    echo $preview; // echo the preview image
    		the_content('Read more'); ?>
    		<div style="width:860px;border-top:1px dotted #999999;">
    		<span style='float: right;'>
    		<?php previous_post_link('<h6>%link</h6>', 'Next project', TRUE); ?></span>
    		<span style='float: left;'>
    		<?php next_post_link('<h6>%link</h6>', 'Previous project', TRUE); ?></span>
    		</div>

    This will add line above the links .

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.