WordPress.org

Ready to get started?Download WordPress

Forums

Post thumbnails (4 posts)

  1. srpd
    Member
    Posted 4 years ago #

    Hi i'm using 2.9.x version of wordpress and the new thumbnail funcion.

    To use it i set my function.php in this way :

    <?php
    if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9
    	add_theme_support( 'post-thumbnails' );
    	set_post_thumbnail_size( 270, 100, true ); // Normal post thumbnails
    	add_image_size( 'single-post-thumbnail', 500, 300, true ); // Permalink thumbnail size
    add_image_size( 'related-post-thumbnail', 100, 100, true ); // Permalink thumbnail size
    }
    
    php?>

    my question: i need another thumbnail of different dimension to insert it in

    <? $quantipost = '10'; // totale dei post da mostrare ?>
    <h2> <?=$quantipost; ?> Post a caso</h2>
        <ul>
          <?php
     $rand_posts = get_posts('numberposts=$quantipost&orderby=rand');
     foreach( $rand_posts as $post ) :
     ?>
          <li><a href="<?php the_permalink(); ?>">
            <?php the_title(); ?>
            </a></li>
          <?php endforeach; ?>
        </ul>

    is it possible?

    when i put <?php the_post_thumbnail( 'related-post-thumbnail' ); ?> in that funcion the pic that is showed is always the same, how can i solve this?
    thanks.

  2. srpd
    Member
    Posted 4 years ago #

    this is the function that i'm trying to use :

    <div id="related_post">
    <h4>Questo articolo ti &egrave piaciuto, allora leggi anche:</h4>
        <ul>
          <?php
     $rand_posts = get_posts('numberposts=5&orderby=rand');
     foreach( $rand_posts as $post ) :
     ?>
          <li><a href="<?php the_permalink(); ?>">
            <?php the_title(); ?><?php the_post_thumbnail( 'related-post-thumbnail' ); ?>
            </a></li>
          <?php endforeach; ?>
        </ul>
    </div>
  3. srpd
    Member
    Posted 4 years ago #

    anyone can give me a hint or suggestion? :)

  4. Brandon Dove
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.