Jump to content

position divs in php


indigojones66

Recommended Posts

Re:http://indigojones.co.uk/ana/philosophers/image5/
Hi. I have made an attachment page for a wordpress site but wish to move the title/text to the right of the image and also move the next and previous buttons to bottom right of the page. Could you help? Thanks in advance

 <?php get_header(); ?>

<?php get_template_part('element', 'page-header'); ?>

<div id="main" class="main">
    <div class="container">
        <section id="content" class="content">
            <?php if(have_posts()) while(have_posts()): the_post(); ?>
            <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                <div class="page-content">
                    <?php the_content(); ?>
                    <?php cpotheme_post_pagination(); ?>
                </div>
            </div>
            <?php comments_template('', true); ?>
            <?php endwhile; ?>
        </section>
        <?php get_sidebar(); ?>
        <div class="clear"></div>
    </div>
</div>

<?php echo wp_get_attachment_image( get_the_ID(), 'large' ); ?>
 
<h6 class="post-title"><?php the_title(); ?></h6>

<div class="entry">
<div class="entry-inner">
<?php the_content(); ?>
</div>
<div class="clear"></div>
</div><!--/.entry-->

<nav id="image-navigation" class="navigation image-navigation">
                <div class="nav-links">
                <?php previous_image_link( false, '<div class="previous-image">' . __( 'Next Image', '$text_domain' ) . '</div>' ); ?>
                <?php next_image_link( false, '<div class="next-image">' . __( 'Previous Image', '$text_domain' ) . '</div>' ); ?>
                </div><!-- .nav-links -->
            </nav><!-- #image-navigation -->




<?php get_footer(); ?>
Edited by Ch0cu3r
Link to comment
Share on other sites

This is not achieved with PHP. How elements appear/positioned on your webpage is down to your HTML/CSS.

 

Your navigation links can be aligned to the right, by applying  text-align: right;  I presume to the .navigation selector in your stylesheet

 

To have the image title appear to the side of the image, first swap the imge and post tile lines around, so its

<h6 class="post-title"><?php the_title(); ?></h6>
<?php echo wp_get_attachment_image( get_the_ID(), 'large' ); ?>

Then add the following selector to your stylesheet

h6.post-title {
    float: right;
    margin-top: 15px;
}
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.