Title: Shortcode problems
Last modified: August 20, 2016

---

# Shortcode problems

 *  [abdabs](https://wordpress.org/support/users/abdabs/)
 * (@abdabs)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/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\” />](https://wordpress.org/support/topic/shortcode-problems/$url?output_format=md)
   </div> <h2 class=\”title\”>[$title](https://wordpress.org/support/topic/shortcode-problems/$url?output_format=md)
   </h2> <p>$text“; if($attachment) echo “[<span>Last ned</span>](https://wordpress.org/support/topic/shortcode-problems/$attachment?output_format=md)“;
   if($url) echo “[<span>Les mer</span>](https://wordpress.org/support/topic/shortcode-problems/$url?output_format=md)“;
   echo “</p> </div>
 *  </div>”;
    }
 * add_shortcode(‘blokker’, ‘print_block’);

The topic ‘Shortcode problems’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [abdabs](https://wordpress.org/support/users/abdabs/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/shortcode-problems/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
