WordPress.org

Support

Support » Themes and Templates » Feat image link to page url ??

Feat image link to page url ??

  • Hi

    I’m trying to get a child theme working, and are having promblems with function.php, and getting teatured image to link to the page url ..

    <?php
    function hent_pages(){
    
    	$args = array(
    		'sort_order' => 'ASC',
    		'post_type' => 'page',
    		'sort_column' => 'menu_order'
    	);
    
    	$pages = get_pages($args);
    
    	foreach ($pages as $page) {
    		if($page->post_parent == 0){
                            echo '<div class="polaroid">';
    
    			//echo $page->post_title . "<br>";
    
                            $feat_image = wp_get_attachment_url( get_post_thumbnail_id($page->ID) );
    			echo '<div class="polaroidimage"><a href="" rel="bookmark"><img src="'.$feat_image.'"></a>';
    			echo '<div class="polaroidtitle">hej<br></div>';
                            echo '</div></div>';
    
    		}
    	}
    }
    ?>

    It’s the a href i need to transform into php, and i can’t figure out how to do it, maybe i’ve bin sitting to many hours behind the screen, so i’m not thinking that clear anymore 😉

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • echo '<div class="polaroidimage"><a href="'.get_permalink($page->ID).'" rel="bookmark"><img src="'.$feat_image.'"></a>';

    Thanks you very much 🙂

    Thought that it had something to do with the page id, but was told that i couldn’t use get_permalink ..

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feat image link to page url ??’ is closed to new replies.