Viewing 5 replies - 1 through 5 (of 5 total)
  • Something like:

    <ul>
     <?php
     $side_posts = get_posts('numberposts=7&offset=10');
     foreach($side_posts as $post) :
     setup_postdata($post); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
     <?php endforeach; ?>
     </ul>
     <?php wp_reset_query();?>

    should work.

    https://codex.www.ads-software.com/Template_Tags/get_posts

    Thread Starter enviado

    (@enviado)

    Thanks esmi! It works as i want but i dont know what happens with the thumbnail. It shows different in the sidebar than in the content. This is the code in index:

    </p>
    		<a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
    		<?php the_excerpt(); ?>

    And i ve put in the sidebar like:

    <?php
     $side_posts = get_posts('numberposts=5&offset=10');
     foreach($side_posts as $post) :
     setup_postdata($post); ?>
    <li><p><a href="<?php the_permalink(); ?>"><?php dp_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?></a>
    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></p></li>
     <?php endforeach; ?>
     </ul>
     <?php wp_reset_query();?>

    But the image post is bigger than in the index…

    By the way, this are the lines about thumbnail in functions.php:

    # Displays post image attachment (sizes: thumbnail, medium, full)
    function dp_attachment_image($postid=0, $size='thumbnail', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	if ($images = get_children(array(
    		'post_parent' => $postid,
    		'post_type' => 'attachment',
    		'numberposts' => 1,
    		'post_mime_type' => 'image',)))
    		foreach($images as $image) {
    			$attachment=wp_get_attachment_image_src($image->ID, $size);
    			?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
    		}
    }

    Any help with this?

    The following CSS is almost certainly reducing the final displayed image size in the content area:

    #content .post img {
    border:3px solid #EFEFEF;
    float:left;
    margin:2px 8px 4px 0;
    width:94px;
    }
    Thread Starter enviado

    (@enviado)

    Thanks again, esmi, but it doesn’t work… i ve changed the css like this:

    #sidebar .post img {
    border:3px solid #EFEFEF;
    float:left;
    margin:2px 8px 4px 0;
    width:94px;
    }

    But nothing happens… the size of the thumbnail is not the same than in #content…

    Thread Starter enviado

    (@enviado)

    well, i’ll try to ask in the css forum

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to add more headlines in sidebar’ is closed to new replies.