SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    SitePoint Addict aliqayyum's Avatar
    Join Date
    Oct 2009
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thumbs up how to align thumbnail in center

    hi friends

    kindly open this http://fancyblend.com/

    you can see image featured aligned in left!

    i want to add it on center of layout!
    waiting for your kind help

  2. #2
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One option - if you are okay using inline styling - is to make the anchor element around the image have a display: block, margin: 0 auto and then place the width of the contained element in the anchors inline style, since you can't place that in your external stylesheet.

  3. #3
    SitePoint Addict aliqayyum's Avatar
    Join Date
    Oct 2009
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Zarin Denatrose View Post
    One option - if you are okay using inline styling - is to make the anchor element around the image have a display: block, margin: 0 auto and then place the width of the contained element in the anchors inline style, since you can't place that in your external stylesheet.
    this is a code, can you edit, how it can be done

    <div id="featured">

    <!-- If home page, show featured image, if not... don't show anything -->

    <?php if(! $paged || $paged < 2) : ?>
    <?php if (have_posts()) : ?>
    <?php query_posts('showposts=1'); while (have_posts()) : the_post(); ?>
    <a href="<?php the_permalink() ?>" title="<?php echo get_the_excerpt(); ?>"><?php the_post_thumbnail('featured-image'); ?></a>
    <?php echo "<br />"; ?>
    <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
    <div class="featured-cat"><?php the_category(', ') ?></div>
    <div class="featured-info">
    <?php $myExcerpt = get_the_excerpt(); $tags = array("<p>", "</p>"); $myExcerpt = str_replace($tags, "", $myExcerpt); echo $myExcerpt; ?>
    <a href="<?php the_permalink() ?>">Continue Reading</a>
    </div><!-- /.featured-info -->
    <?php endwhile;?>
    <?php wp_reset_query(); ?>
    <?php endif; ?>
    <?php endif; ?>

    </div><!-- /#featured -->

  4. #4
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've actually found a better solution that works entirely inside your external CSS files.

    Find the CSS stylesheet /wp-content/themes/deliciouslysimple/style-light.css, and locate this line:

    Code:
     #featured img {max-width: 640px; margin: 3px 0 10px 0; height: auto;}
    And alter it to this:

    Code:
     #featured img {max-width: 640px; margin: 3px 0 10px 0; height: auto; display: block; margin: 0 auto}
    I hope this helps!

  5. #5
    SitePoint Addict aliqayyum's Avatar
    Join Date
    Oct 2009
    Posts
    303
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks zarin
    works fine

  6. #6
    SitePoint Addict Zarin Denatrose's Avatar
    Join Date
    Jan 2009
    Location
    Surrey BC, Canada
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad to help, though it now occurs to me that there are who margin rules in there. It's not essential to remove the first one, but I'd do it all the same.

    I hope the rest of the project goes well for you!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •