Shortcode problems
-
Hi,
My problem is that the variables doesn’t pass proparly, and it’s given it’s default values.
I use this call: [blokker attachment=2,url=’/?p=62′,title=’lyst’,img=’/wp-content/themes/CleanBlog/img/prove.jpg’,text=’Om’]
Here is how the var_dump of the $params looks like:
array(1) { [0]=> string(97) “attachment=2,url=’/?p=62′,title=’lyst’,img=’/wp-content/themes/CleanBlog/img/prove.jpg’,text=’Om'” }Any help?
—————————————-
function print_block($params = array()){// default parameters
extract(shortcode_atts(array(
‘url’ => ‘url’,
‘title’ => ‘title’,
‘attachment’ => ‘none’,
‘img’ => ‘sitemap’,
‘text’ => ‘sitemap’
), $params));
var_dump($params);$title = utf8_encode($title);
$text = utf8_encode($text);echo “<div class=\”postblock\”>
<div class=\”post\”>
<div class=\”thumbnail\”><img height=\”130\” width=\”240\” src=\”$img\” alt=\”$title\” title=\”$title\” /></div>
<h2 class=\”title\”>$title</h2>
<p>$text
“;
if($attachment) echo “<span>Last ned</span>“;
if($url) echo “<span>Les mer</span>“;
echo “</p>
</div></div>”;
}add_shortcode(‘blokker’, ‘print_block’);
The topic ‘Shortcode problems’ is closed to new replies.