Feat image link to page url ?? (3 posts)

  1. boblebad
    Posted 3 years ago #


    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 ..

    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 ;-)


  2. s_ha_dum
    Posted 3 years ago #

    echo '<div class="polaroidimage"><a href="'.get_permalink($page->ID).'" rel="bookmark"><img src="'.$feat_image.'"></a>';
  3. boblebad
    Posted 3 years ago #

    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 ..

Topic Closed

This topic has been closed to new replies.

About this Topic