• I am trying to place this css-only image slider (https://csscience.com/responsiveslidercss3/) into my theme but can’t find a way to replace these titles and captions with the WordPress ones.

    i.e. can’t find a template tag or function code to fetch image attributes..

    here’s how I am calling images in the existing setup.

    <?php
    	if(!function_exists('wp_head')) {
    
    		if(file_exists('../../../../wp-load.php')) {
    			include '../../../../wp-load.php';
    		} else {
    			include '../../../../../wp-load.php';
    		}
    
    		$postId = $_POST['id'];
    		$next = $_POST['next'];
    		$prev = $_POST['prev'];
    
    		//Query the database
    		query_posts( array (
    			'post_type' => 'portfolio',
    			'p' => $postId,
    			)
    		);
    
    	}
    
        if (have_posts()) : while (have_posts()) : the_post(); 
    
    	$image1 = get_post_meta($post->ID, 'tz_portfolio_image', TRUE);
    	$image2 = get_post_meta($post->ID, 'tz_portfolio_image2', TRUE);
    	$image3 = get_post_meta($post->ID, 'tz_portfolio_image3', TRUE);
    	$image4 = get_post_meta($post->ID, 'tz_portfolio_image4', TRUE);
    	$image5 = get_post_meta($post->ID, 'tz_portfolio_image5', TRUE);
    	$image6 = get_post_meta($post->ID, 'tz_portfolio_image6', TRUE);
    	$image7 = get_post_meta($post->ID, 'tz_portfolio_image7', TRUE);
    	$image8 = get_post_meta($post->ID, 'tz_portfolio_image8', TRUE);
    	$image9 = get_post_meta($post->ID, 'tz_portfolio_image9', TRUE);
    	$image10 = get_post_meta($post->ID, 'tz_portfolio_image10', TRUE);
    	$image_height = get_post_meta($post->ID, 'tz_portfolio_image_height', TRUE);
    	$embed = get_post_meta($post->ID, 'tz_portfolio_embed_code', TRUE);
    	$audio1 = get_post_meta($post->ID, 'tz_audio_mp3', TRUE);
    	$audio2 = get_post_meta($post->ID, 'tz_audio_ogg', TRUE);
    	$video_height = get_post_meta($post->ID, 'tz_video_height', TRUE);
    
        ?>
    
        <!--BEGIN #magic-door-wrap-->
        <div id="magic-door-wrap">
    
            <!--BEGIN .inner-->
            <div class="inner clearfix">
    
            	<!--BEGIN #slider-->
                <div id="slider">
    
                <?php if( !empty($image1) ) { ?>
    
                    <!--BEGIN .slides_container-->
                    <div class="slides_container clearfix">
    
                    <?php if( !empty($image1) ) { ?>
                        <div><img height="<?php echo $image_height; ?>" src="<?php echo $image1; ?>" alt="<?php the_title(); ?>" width="680px" /></div>
                    <?php } ?>
    
                    <?php if( !empty($image2) ) { ?>
                        <div><img src="<?php echo $image2; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image3) ) { ?>
                        <div><img src="<?php echo $image3; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image4) ) { ?>
                        <div><img src="<?php echo $image4; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image5) ) { ?>
                        <div><img src="<?php echo $image5; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image6) ) { ?>
                        <div><img src="<?php echo $image6; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image7) ) { ?>
                        <div><img src="<?php echo $image7; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image8) ) { ?>
                        <div><img src="<?php echo $image8; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image9) ) { ?>
                        <div><img src="<?php echo $image9; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <?php if( !empty($image10) ) { ?>
                        <div><img src="<?php echo $image10; ?>" alt="<?php the_title(); ?>" width="680px"  /></div>
                    <?php } ?>
    
                    <!--END .slides_container .clearfix-->
                    </div>
    
    .............
  • The topic ‘Fetch Image Attributes into a Slider’ is closed to new replies.