Horje
use lightview on the mainpage with fullscreen theme - Wordpress Solution
[Solved] - use lightview on the mainpage with fullscreen theme - Wordpress Solution
Try following codes
Hi everybody, i´ve the following issue. i like to view the media which is included in an article by clicking on the article thumbnail with the lightview plugin. the main problem is, that i am not able to get the url of the media in the article to replace the current link wich is targeted to the permalink of the article. normaly the link is like that:

<a href="<?php the_permalink() ?>" rel="set[myset]" title="Permanent Link to <?php the_title_attribute(); ?>"><?php get_the_image( array( 'custom_key' => array( 'thumbnail' ), 'default_size' => '320x320', 'width' => '320', 'height' => '320', 'link_to_post' => false ) ); ?></a>
to get an idea what i want, here the link to my site: http://www.sichtweiser.com can anybody help me??

Solution - 1

Hi, this code will list all the attachments you have associated to a post. all the information related to the attachment is in the loop in tha $attachment var. in this example i show you how to display the links, using the_attachment_link() template function. inside the loops there are many variables available for you such as: $extension, $file_name, $file_type, $link;


<?php
//originally based on http://www.wprecipes.com/how-to-show-wordpress-post-attachments
$args = array(
	'post_type' => 'attachment',
	'numberposts' => -1,
	'post_status' => null,
	'post_parent' => $post->ID
);
$attachments = get_posts($args);
//print_r($attachments);
echo '<ul>';
foreach ( (array)$attachments as $attachment) {
	$link = wp_get_attachment_url( $attachment->ID );
	$pathinfo = pathinfo($link);
	$extension = $pathinfo['extension'];
	$file_name = $pathinfo['filename'].'.'.$pathinfo['extension'];
	$file_type = $attachment->post_mime_type;
	
	echo $extension, $file_name, $file_type, $link;
	echo '<li>';
		the_attachment_link($attachment->ID, false);
	echo '</li>'."\n";
}
echo '</ul>';	
?>
let me know if it works for you. - wjm


Solution - 2

<?php
$size = 'large';
wp_get_attachment_image_src($image_ID, $size, false);
image_ID is id of the attached media. if you want to use featured images use
<?php
$size = 'large';
$image_ID = get_post_meta($post->ID, '_thumbnail_id', true);
$img = wp_get_attachment_image_src($image_ID, $size, false);
$img is array, first leement is url, second and third is image dimensions


Solution - 3

Hello I want to give you some suggestion: 1- http://wordpress.org/extend/plugins/lightbox-2/ See example: http://stimuli.ca/lightbox/ 2- http://wordpress.org/extend/plugins/lightbox-gallery/ Screenshots: http://wordpress.org/extend/plugins/lightbox-gallery/screenshots/ P.S: I don't know 1st or 2nd one will work via 3.0 or not. The plugins page doen't contain any information about this. 3- http://wordpress.org/extend/plugins/lightbox-plus/ (BEST CHOISE) Screenshots: http://wordpress.org/extend/plugins/lightbox-plus/screenshots/ P.S: working with wp3.0 you can see here how it's working (using it on plugin page) : http://www.23systems.net/portfolio/ 4-http://wordpress.org/extend/plugins/photo-lightbox/ Screenshots: http://wordpress.org/extend/plugins/photo-lightbox/screenshots/ best regards,

Date: 2022-10-21 05:21:47
Category: Wordpress
More for You