wp theme mod for thumbnails?

sugarcookie

Please don't ban me
Dec 4, 2009
67
1
0
in K.C
buybulkbatteries.com
Hey all...

Please bear with me, as I'm not a programmer, but I can figure some shit out.

Is there a way to force an image to the tomthumb script?

Meaning, I have a theme that I am using with a featured post slideshow but the images are auto generated within the posts from feedwordpress via url as the image source.


The theme uses the tomthumb script (wich requires a custom field for the images).

I can use the "get_the_image" plugin but it doesn't work quite right because the theme is trying to pull the image from the custom fields, and the get_the_image plugin doesn't "push" the image to the custom field for the theme to recognize and isn't within the loop for resizing to fit the slideshow.

Does this make sense?

Here's the site: Wow-Gold-Secrets.com

I know some of the featured post content doesn't have an image associated with it, but I'm mainly concerened with the slideshow at the top.

Any suggestions welcome... I'll post boobs

Thanks!
 


Here you go...

986.jpg


982.jpg


786.jpg
 
theres a few ways you can go about using thumbnails in wordpress, tomthumb is a good script. You could also try a very simple solution like the following which will add the first image from each post without a custom filed.

Code:
<?php
/*Show external images thumbnails with excerpts, calls first image from post and then displays it === place in wp-includes/functions.php */

function getImage($num) {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, '<img');
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, '<img', $start);
$post = substr($content, $imgBeg);
$imgEnd = strpos($post, '>');
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
$image[$i] = $postOutput;
$start=$imgEnd+1;
}
if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
$more = 0;
}

then place this snippet in your theme, index.php, home.php, archive.php or any other area within the loop

Code:
<?php getImage('1'); ?>
 
  • Like
Reactions: Edwin
theres a few ways you can go about using thumbnails in wordpress, tomthumb is a good script. You could also try a very simple solution like the following which will add the first image from each post without a custom filed.

Code:
<?php
/*Show external images thumbnails with excerpts, calls first image from post and then displays it === place in wp-includes/functions.php */

function getImage($num) {
global $more;
$more = 1;
$link = get_permalink();
$content = get_the_content();
$count = substr_count($content, '<img');
$start = 0;
for($i=1;$i<=$count;$i++) {
$imgBeg = strpos($content, '<img', $start);
$post = substr($content, $imgBeg);
$imgEnd = strpos($post, '>');
$postOutput = substr($post, 0, $imgEnd+1);
$postOutput = preg_replace('/width="([0-9]*)" height="([0-9]*)"/', '',$postOutput);;
$image[$i] = $postOutput;
$start=$imgEnd+1;
}
if(stristr($image[$num],'<img')) { echo '<a href="'.$link.'">'.$image[$num]."</a>"; }
$more = 0;
}
then place this snippet in your theme, index.php, home.php, archive.php or any other area within the loop

Code:
<?php getImage('1'); ?>


I tried this, but I get the same result as with the get the image script... the images are not getting resized by the theme's thumb call because the theme is trying to call the thumbs from the custom fields... so skipping the custom fields is not working.

...either that or I'm not putting the code within the proper place within the loop, but I've tried several different places and am getting the image, but way oversized for the featured slideshow box.


Thanks btw for you help. If you have any other suggestions, I would love to hear them :)
 
Here's my home.php code... and where I have entered the thumb call

<?php get_header(); ?>

<?php
if ( function_exists('dsq_comment_count') ) {
remove_action('loop_end', 'dsq_comment_count');
add_action('arras_above_index_news_post', 'dsq_comment_count');
}

$stickies = get_option('sticky_posts');
?>

<div id="content" class="section">
<?php arras_above_content() ?>

<?php if ( ( $featured1_cat = arras_get_option('slideshow_cat') ) !== '' && $featured1_cat != '-1' ) : ?>
<!-- Featured Slideshow -->
<div class="featured clearfix">
<?php
if ($featured1_cat == '-5') {
if (count($stickies) > 0)
$query = array('post__in' => $stickies, 'showposts' => arras_get_option('slideshow_count') );
} elseif ($featured1_cat == '0') {
$query = 'showposts=' . arras_get_option('slideshow_count');
} else {
$query = 'showposts=' . arras_get_option('slideshow_count') . '&cat=' . $featured1_cat;
}

$q = new WP_Query( apply_filters('arras_slideshow_query', $query) );
?>
<div id="controls" style="display: none;">
<a href="" class="prev"><?php _e('Prev', 'arras') ?></a>
<a href="" class="next"><?php _e('Next', 'arras') ?></a>
</div>
<div id="featured-slideshow">
<?php $count = 0; ?>
<?php if ($q->have_posts()) : while ($q->have_posts()) : $q->the_post(); ?>
<div <?php if ($count != 0) echo 'style="display: none"'; ?>>

<a class="featured-article" href="<?php the_permalink(); ?>" rel="bookmark" style="background: url(<?php getImage('1'); no-repeat #1E1B1A; ?>
<span class="featured-entry">
<span class="entry-title"><?php the_title(); ?></span>
<span class="entry-summary"><?php echo arras_strip_content(get_the_excerpt(), 20); ?></span>
<span class="progress"></span>
</span>
</a>
</div>
<?php $count++; endwhile; endif; ?>
</div>
</div>
<?php endif; ?>

<!-- Featured Articles -->
<?php if (!$paged) : if ( ($featured2_cat = arras_get_option('featured_cat') ) !== '' && $featured2_cat != '-1' ) : ?>
<div id="index-featured">
<div class="home-title"><?php _e('Featured', 'arras') ?></div>
<?php
if ($featured2_cat == '-5') {
if (count($stickies) > 0)
$query2 = array('post__in' => $stickies, 'showposts' => arras_get_option('featured_count') );
} elseif ($featured2_cat == '0') {
$query2 = 'showposts=' . arras_get_option('featured_count');
} else {
$query2 = 'showposts=' . arras_get_option('featured_count') . '&cat=' . $featured2_cat;
}

$q2 = new WP_Query( apply_filters('arras_featured_query', $query2) );
arras_get_posts('featured', $q2);
?>
</div><!-- #index-featured -->
<?php endif; endif; ?>


<?php arras_above_index_news_post() ?>

<!-- News Articles -->
<div id="index-news">
<div class="home-title"><?php _e('Latest Headlines', 'arras') ?></div>
<?php
$news_query = array(
'cat' => arras_get_option('news_cat'),
'paged' => $paged,
'showposts' => ( (arras_get_option('index_count') == 0 ? get_option('posts_per_page') : arras_get_option('index_count')) )
);

// if you are a WP plugin freak you can use 'arras_news_query' filter to override the query
wp_reset_query(); query_posts(apply_filters('arras_news_query', $news_query));

arras_get_posts('news') ?>

<?php if(function_exists('wp_pagenavi')) wp_pagenavi(); else { ?>
<div class="navigation clearfix">
<div class="floatleft"><?php next_posts_link( __('Older Entries', 'arras') ) ?></div>
<div class="floatright"><?php previous_posts_link( __('Newer Entries', 'arras') ) ?></div>
</div>
<?php } ?>
</div><!-- #index-news -->

<?php arras_below_index_news_post() ?>

<?php $sidebars = wp_get_sidebars_widgets(); ?>

<div id="bottom-content-1">
<?php if ( $sidebars['sidebar-4'] ) : ?>
<ul class="clearfix xoxo">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Content #1') ) : ?>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>

<div id="bottom-content-2">
<?php if ( $sidebars['sidebar-5'] ) : ?>
<ul class="clearfix xoxo">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Bottom Content #2') ) : ?>
<?php endif; ?>
</ul>
<?php endif; ?>
</div>

<?php arras_below_content() ?>
</div><!-- #content -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>


I honestly am giving up on this theme for the purposes of being able to pull off site images. If you can help I would love it though