Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
need help with 14 lines of code :D - newbie here
Old 09-20-2011, 03:00 AM need help with 14 lines of code :D - newbie here
rober7's Avatar
Skilled Talker

Posts: 96
Name: robert haba
Trades: 0
is a WORDPRESS snippet
i found this nice snippet on the web but because i don`t know php i need some help.
This code extract the attached picture from post and display it as a shortcode. I dont wan`t to modify my template and insert [postimage] (-> the shortcode) in my index.php
Code:
function cwc_postimage($atts, $content = null) {
	extract(shortcode_atts(array(
		"size" => 'thumbnail',
		"float" => 'none'
	), $atts));
	$images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . get_the_id() );
	foreach( $images as $imageID => $imagePost )
	$fullimage = wp_get_attachment_image($imageID, $size, false);
	$imagedata = wp_get_attachment_image_src($imageID, $size, false);
	$width = ($imagedata[1]+2);
	$height = ($imagedata[2]+2);
	return '<div class="postimage" style="width: '.$width.'px; height: '.$height.'px; float: '.$float.';">'.$fullimage.'</div>';
}
add_shortcode("postimage", "cwc_postimage");
my thumbs have "thumb" on custom fields (i need to copy image url and paste it in the custom fileds -> below posts in wp dashbord) and i need help to modify that code and add "thumb" automaticaly on image extracted from this piece of code.
__________________

Please login or register to view this content. Registration is FREE
- open blog | working on it ...
rober7 is offline
Reply With Quote
View Public Profile Visit rober7's homepage!
 
 
Register now for full access!
Old 09-21-2011, 08:16 PM Re: need help with 14 lines of code :D - newbie here
Physicsguy's Avatar
404 - Title not found

Posts: 920
Name: Scott Kaye
Location: Ontario
Trades: 0
So, from what I've gathered from this post is you want something to do with 'thumb'(s). A thumb, as in a thumbnail? A thumb, as in the thing on your hand?

Do you want a watermark picture of a thumb on all your images? Or make thumbnails for all your images?

I don't understand the question.
__________________
Check out my
Please login or register to view this content. Registration is FREE
or my
Please login or register to view this content. Registration is FREE
!
Physicsguy is offline
Reply With Quote
View Public Profile
 
Old 09-22-2011, 04:25 AM Re: need help with 14 lines of code :D - newbie here
rober7's Avatar
Skilled Talker

Posts: 96
Name: robert haba
Trades: 0
no ... want to automatically add attached image url in my custom field for for front page thumbnail (thumb is custom field name)
__________________

Please login or register to view this content. Registration is FREE
- open blog | working on it ...
rober7 is offline
Reply With Quote
View Public Profile Visit rober7's homepage!
 
Reply     « Reply to need help with 14 lines of code :D - newbie here
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11705 seconds with 12 queries