-2

I'm just looking for little help to make the right code.

What i want.

echo "<a target='_blank' href='https://www.wbesite.kom". get_the_title() ."'>" IMAGE HERE "</a>";

This code doesn't work simply because I don't understand how to put image in "IMAGE HERE".

Can someone help?

VC.One
  • 14,790
  • 4
  • 25
  • 57
ANdy
  • 13
  • 6

2 Answers2

1

You forgot to add the dot . operator before and after your IMAGE HERE.

Try this :

$imagehtml = '<img  src="path/to/image" />'; 
echo "<a target='_blank' href='https://www.wbesite.kom". get_the_title() ."'>". $imagehtml ."</a>";
VC.One
  • 14,790
  • 4
  • 25
  • 57
M0ns1f
  • 2,705
  • 3
  • 15
  • 25
0

I put this together from this link. Perhaps it will work for you.

<?php

function get_the_title() {
echo "result of the get_the_title()";
}

// A few settings
$img_file = 'http://www.abarrak.com/public/icons/stackoverflow-icon.png';

// Read image path, convert to base64 encoding
$imgData = base64_encode(file_get_contents($img_file));

// Format the image SRC:  data:{mime};base64,{data};
$src = 'data: '. $img_file .';base64,'.$imgData;

// Echo out a sample image
$img =  '<img src="'.$src.'">';

echo "<a target='_blank' href='https://www.wbesite.kom". get_the_title() 
."'>" . $img .  "</a>";

?>