Jump to content

Recommended Posts

hi guys

I'm stuck on a php code, I have searching over the web but nothing helps me, that's why I am here.

that's what I have at the moment, but it's not correct... It shows the image to all other titles on the frontpage, I want just the correct icon/image before the correct title.
 

if ( $show_title == 1 ) {	
	$post_id = 133; // post ID
	$width = "20px"; // width of the image
	$height = "20px"; // height of the image
	$space = str_repeat(' ', 1); // white space(s) + how much spaces
	$icoontje = get_field( 'category_icon', $post_id );
	
    $list_pages_html .= '<h3 class="page-list-ext-title"><img src="'.$icoontje.'" width="'.$width.'" height="'.$height.'">'.$space.'<a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';
} else {
$list_pages_html .= '<h3 class="page-list-ext-title"><a href="'.$link.'" title="'.esc_attr($page->post_title).'">'.$page->post_title.'</a></h3>';	
}

Can anybody help me please?  Thank you.

Link to comment
https://forums.phpfreaks.com/topic/302312-an-iconimage-before-the-title-of-a-page/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.