Forum Replies Created

Viewing 8 replies - 46 through 53 (of 53 total)
  • Thread Starter Damien

    (@takster)

    single.php resolved, i used

    <?php
    $images = get_post_meta($post->ID, 'images', true);
    //check that we have a custom field
    if ($images != "")
    {
    // Separate our comma separated list into an array
    $images = explode(",", $images);
    //loop through our new array
    foreach ($images as $image)
    {
    echo "<img src='https://localhost.com/wp-content/themes/classipress/timthumb.php?src=" . $image . "&w=600&zc=0' alt='' />";
            }
          }
    ?>

    however my above index.php code does not understand how to grab only the first image, and drop the comma between any extra uploaded images and only show the first uploded image.

    At the moment I get

    <a href="https://localhost.com/2009/12/hi-yall/" title="hi yall’">
    <img src="https://localhost.com/wp-content/themes/press/timthumb.php?src=https://localhost.com/wp-content/uploads/press/hi-yall-7879.jpg,https://localhost.com/wp-content/uploads/press/hi-yall-7879.jpg&w=300&zc=1" alt="" border="0" /></a>

    I need:

    <a href="https://localhost.com/2009/12/hi-yall/" title="hi yall’">
    <img src="https://localhost.com/wp-content/themes/press/timthumb.php?src=https://localhost.com/wp-content/uploads/press/hi-yall-7879.jpg&w=300&zc=1" alt="" border="0" /></a>

    I solved a similar problem of having two different avatar sizes show by simply changing the size in the plugin file for user photo. Now it’s consistent sizing on the avatars list and author/single.php pages.

    “Thumbnail” and the “full size” are the same now basically.

    #define('USERPHOTO_DEFAULT_THUMB_DIMENSION', 100);

    Damien

    (@takster)

    @yashzn

    1: jquery
    2: jquery
    3: jquery
    4: wp-postratings

    ??

    Thread Starter Damien

    (@takster)

    upgraded to latest version ‘vote it up’ 1.2.2 and even more errors.

    The only thing that works by the look of it are the vote count and button and the widget, something has gone wrong with the function codes described in the readme.txt. Anyone have this working 100%? it seems support is dead for this otherwise fantastic plugin ??
    Cant pull an array of user ID’s anymore or display the vote count via template code. Damn.

    <?php GetVotes($post_ID); ?>

    Notice: Undefined variable: post_ID in C:\xampp\htdocs\server\old\wp-content\themes\default\single.php on line 24

    =(

    Thread Starter Damien

    (@takster)

    no problems mate, and just as an added note for those with no idea;

    <?php if ($count%3== 0) : ?>

    3 being the number of articles shown before the extra code you add to display below it, a banner or anything you like.

    Thread Starter Damien

    (@takster)

    Works for me now ??

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
    <?php if ($count%3== 0) : ?>
    
    // make with the usual article content
    //and do something under every third post
    
    <?php else : ?>
    
    // make with the usual article content
    
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
    Thread Starter Damien

    (@takster)

    hmmm good point… I just noticed what you mean, I’m using a modified version of this:

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
      <?php if ($count == 2) : ?>
              //Paste your ad code here
              <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
              <?php the_excerpt(); ?>
       <?php else : ?>
              <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
              <?php the_excerpt(); ?>
      <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>

    https://www.smashingmagazine.com/2009/06/10/10-useful-wordpress-loop-hacks/

    Gonna have to read up and get my head around this, thanks for your help so far ??

    Thread Starter Damien

    (@takster)

    I’ve come up with a solution (I think) but I’m really unsure if this is the way forward… I’m getting some strange behaviour from this when I change the count so it’s most likely wrong.

    As I said, I was after something like this (no content here, just an image link), I’m pulling the forst image from each post and displaying it, and in after every 4th post I would like to add a div called “thumbs”

    Post 1 Image 1
    Post 2 Image 2
    Post 3 Image 3
    Post 4 Image 4
    </div><div thumbs>
    Post 5 Image 5
    Post 6 Image 6
    Post 7 Image 7
    Post 8 Image 8
    </div><div thumbs>
    post 9 etc etc…

    This is what kinda works… anyone see what I’ve done wrong?

    <?php if (have_posts()) : ?>
    <?php $count = 0; ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php $count++; ?>
    <?php if ($count%4== 0) : ?>
    
    //this is for the after 4th, 8th, 12 etc posts
    </div><div class="thumbs">
    //end this is for the after 4th, 8th, 12 etc posts  
    
    <?php $postimageurl = get_post_meta($post->ID, 'thumbnail', true);
    if ($postimageurl) {
    ?><div class="thumb">
    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumbnail", true); ?>
    &w=300&zc=1" alt="" /></a>
    <div class="vote">
      <a href="/login" class="like"></a>
       </div>
    <a class="source" href="<?php the_permalink() ?>" target="_blank">Visit the source</a>
    </div>
    
    <?php } else { ?>
    
    <img src="<?php bloginfo('template_directory'); ?>/images/wpshoutlogo.jpg" alt="WPShout.com | No image available" /></a>
    <div class="vote">
    <a href="/login" class="like"></a>
    </div>
    <a class="source" href="<?php the_permalink() ?>" target="_blank">Visit the source</a>
    </div>
    <?php } ?>
    
    <?php else : ?>
    
    <?php $postimageurl = get_post_meta($post->ID, 'thumbnail', true);
    if ($postimageurl) {
    ?><div class="thumb">
    <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    <img src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumbnail", true); ?>
    &w=300&zc=1" alt="" /></a>
    <div class="vote">
    <a href="/login" class="like"></a>
    </div>
    <a class="source" href="<?php the_permalink() ?>" target="_blank">Visit the source</a>
    </div>
    
    <?php } else { ?>
    
    <img src="<?php bloginfo('template_directory'); ?>/images/wpshoutlogo.jpg" alt="" /></a>
    </div>
    <?php } ?>
    
    <?php endif; ?>
    <?php endwhile; ?>
    <?php endif; ?>
Viewing 8 replies - 46 through 53 (of 53 total)