Title: Function not working
Last modified: September 11, 2023

---

# Function not working

 *  [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/)
 * What is wrong here? I followed some models already working but…
 *     ```wp-block-code
       //prova display price2 con IF
       $display_price2 = get_the_author_meta( '2_periodo', $post->post_author ). ' - ' . get_post_meta( $post->ID, "function_prezzo_secondo", true ). ;
   
       if ( ! empty( $display_price2)) {
   
       $display_price2='<div class="listino_prezzi">'. $display_price2 .'</div>';
       //fine prova
       ```
   

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

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17042548)
 * There’s an extra `.` operator at the end of the first assignment line that doesn’t
   belong. There could be other issues, but looking at code out of context makes
   it difficult to know.
 * Do you have `WP_DEBUG` defined as `true` in wp-config.php? Doing so will display
   error messages right on the page. Good for development, bad for production. The
   message ‘unexpected token “;” in path/filename on line _nnn_‘ would give you 
   a good clue on where and what to look for. Meaning something before the `;` is
   not as it should be. In this case it is immediately before. In other cases it
   can even be on a preceding line. Error messages are where PHP realized there 
   is an error, not necessarily where the error really is.
 * We’re happy to help you resolve coding problems when you’re unable to, but resolving
   on your own when possible will get your code working sooner 😉
 *  Thread Starter [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17043540)
 * besides the `.` I forgot the final bracket 🙂
 * I’m trying also to put a <strong>, I’ve tryed a lot of times but..nothing..here
   is my last try:
 *     ```wp-block-code
       $display_price2 = get_the_author_meta( '2_periodo', $post->post_author ). ' ' '<strong>'. get_post_meta( $post->ID, 'function_prezzo_secondo', true ). '</strong>' ' &euro;'.'/ sett.' ;
       if ( ! empty( $display_price2)) {
       $display_price2='<div class="listino_prezzi">'. $display_price2 .'</div>';
       }
       ```
   
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17045069)
 * Too may quotes 🙂 And unnecessary concatenation, though concatenation would be
   syntactically correct, it’s not necessary.
    `$display_price2 = get_the_author_meta('
   2_periodo', $post->post_author ). '<strong>'. get_post_meta( $post->ID, 'function_prezzo_secondo',
   true ). '</strong> &euro;/ sett.';` untested, but should be right… gotta run 
   right now.
 *  Thread Starter [sacconi](https://wordpress.org/support/users/sacconi/)
 * (@sacconi)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17045125)
 * 2 quotes were for displaying a blank space…just before `'<strong>'`
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17048308)
 * Include the blank space with the strong tag `' <strong>'`. While you could have
   used a another `.` operator to add the space, you should avoid concatenating 
   static strings together. Instead combine the strings into a single element. It’s
   not technically wrong to concatenate static strings, but it adds needless complexity
   and makes code more difficult to read.

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

The topic ‘Function not working’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 5 replies
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/function-not-working-2/#post-17048308)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
