Title: Function width
Last modified: August 19, 2016

---

# Function width

 *  [delgado2009](https://wordpress.org/support/users/delgado2009/)
 * (@delgado2009)
 * [15 years ago](https://wordpress.org/support/topic/function-width/)
 * Hello, I want to display something if the width of a game is <=600, and if the
   width is >600 I want to display nothing… how can I do that? I tried to make a
   function but doesn’t work.
 *     ```
       <?php
       function blabla($blabla = '<?php $values = get_post_custom_values("width"); echo $values[0]; ?>') {
       if ( $blabla <= 600) $blabla= "<div style='float:right'>afffff</div>";
       }
       ?>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years ago](https://wordpress.org/support/topic/function-width/#post-2008848)
 * try:
 *     ```
       <?php
       function blabla {
       $values = get_post_custom_values("width"); $blabla =  $values[0];
       if ( $blabla <= 600) $blabla= "<div style='float:right'>afffff</div>";
       }
       ?>
       ```
   
 *  Thread Starter [delgado2009](https://wordpress.org/support/users/delgado2009/)
 * (@delgado2009)
 * [15 years ago](https://wordpress.org/support/topic/function-width/#post-2008988)
 * Parse error: syntax error, unexpected ‘{‘, expecting ‘(‘ in /home/content/html/…/
   functions.php on line 24
 * Doesn’t work 🙁
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years ago](https://wordpress.org/support/topic/function-width/#post-2008993)
 * my bad, i forgot the parameter brackets for the function:
 *     ```
       <?php
       function blabla() {
       $values = get_post_custom_values("width"); $blabla =  $values[0];
       if ( $blabla <= 600) $blabla= "<div style='float:right'>afffff</div>";
       }
       ?>
       ```
   
 * it is also possible that i misunderstood your original idea in your code (?)
 *  Thread Starter [delgado2009](https://wordpress.org/support/users/delgado2009/)
 * (@delgado2009)
 * [15 years ago](https://wordpress.org/support/topic/function-width/#post-2009113)
 * And if I want to do something like : if is width<=600 display something, if is
   width > 600 and width < 750 display something, and if is width > 750 display 
   something… how can I do that? 🙂
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years ago](https://wordpress.org/support/topic/function-width/#post-2009115)
 * [http://www.w3schools.com/php/php_if_else.asp](http://www.w3schools.com/php/php_if_else.asp)
 *     ```
       <?php
       function blabla() {
       $values = get_post_custom_values("width"); $blabla =  $values[0];
       if ( $blabla <= 600) { /*do something*/ }
       elseif( $blabla > 600 && $blabla < 750 ) { /*do something*/  }
       elseif( $blabla >= 750 ) { /*do something*/ }
       }
       ?>
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Function width’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/function-width/#post-2009115)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
