Title: Generated text output from php-code is placed wrongly.
Last modified: August 30, 2016

---

# Generated text output from php-code is placed wrongly.

 *  [Erik Oestergaard](https://wordpress.org/support/users/erik-oestergaard/)
 * (@erik-oestergaard)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/)
 * If I use shortcodes of “Magic Dates” plugin and your “Insert Html Snippet” plugin
   like this in a post:
 *     ```
       <p style="text-align: left;">several paragraphs with text...</p>
       <h3 style="text-align: left;">[magicdate]1941[/magicdate] years</h3>
       <p style="text-align: left;">May 26, [xyz-ihs snippet="ThisYear"] we have [magicdate]1941[/magicdate] years anniversary.</p>
       <p style="text-align: left;">several more paragraphs with text...</p>
       ```
   
 * with this code in your “Insert Html Snippet” plugin:
 *     ```
       <script language="JavaScript">
       <!--
       function y2k(number) { return (number < 1000) ? number + 1900 : number; }
       var c_today = new Date();
       var c_year = y2k(c_today.getYear());
       document.write(''+c_year+'');
       // -->
       </script>
       ```
   
 * I got the result I wants (both plugins insert the generated numbers correct in
   the text).
 * ***
 * But if I use shortcodes of “Magic Dates” plugin and your “Insert PHP Code Snippet”
   like this in a post:
 *     ```
       <p style="text-align: left;">several paragraphs with text...</p>
       <h3 style="text-align: left;">[magicdate]1941[/magicdate] years</h3>
       <p style="text-align: left;">May 26, [xyz-ips snippet="ThisYear"] we have [magicdate]1941[/magicdate] years anniversary.</p>
       <p style="text-align: left;">several more paragraphs with text...</p>
       ```
   
 * with this code in your “Insert PHP Code Snippet” plugin:
 *     ```
       echo date('Y');
       ```
   
 * the “Magic Dates” plugin places the generated number where it should be placed
   in the text, but your “Insert PHP Code Snippet” plugin generates the number correct,
   but places it in the top of the post, before any other text in that post.
 * This occurs also if `[xyz-ips snippet="ThisYear"]` is the only shortcode in a
   post.
 * ***
 * Have I made any error in the php-code (this is almost my first attempt to use
   php-code)?
 * Or what shall I do, if I want to use the php-code to get it placed correct in
   my text?
 * [https://wordpress.org/plugins/insert-php-code-snippet/](https://wordpress.org/plugins/insert-php-code-snippet/)

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

 *  [xyzscripts](https://wordpress.org/support/users/xyzscripts/)
 * (@xyzscripts)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537360)
 * please give a screenshoot or link in that post.
 *  Thread Starter [Erik Oestergaard](https://wordpress.org/support/users/erik-oestergaard/)
 * (@erik-oestergaard)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537391)
 * Link to a test post showing the problem:
 * [http://www.bispeparken.dk/test-post-test-indlaeg-4638](http://www.bispeparken.dk/test-post-test-indlaeg-4638)
 * Screenshot1:
 * [http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot1.jpg](http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot1.jpg)
 * Screenshot2:
 * [http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot2.jpg](http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot2.jpg)
 * Screenshot3:
 * [http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot3.jpg](http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot3.jpg)
 * Screenshot4:
 * [http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot4.jpg](http://www.bispeparken.dk/wp-content/uploads/2015/09/Screenshot4.jpg)
 * I hope these links answer your question above.
 *  [xyzscripts](https://wordpress.org/support/users/xyzscripts/)
 * (@xyzscripts)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537405)
 * we are checking here.There should not be any issue with php snippet or you code.
   working properly.please deactivate and activate all plugins you are installed
   one by one for checking if any plugin is causing this issue or check your style.
 *  Thread Starter [Erik Oestergaard](https://wordpress.org/support/users/erik-oestergaard/)
 * (@erik-oestergaard)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537422)
 * I have now tested all the plugins one at a time without having resolved the issue.
 * I have not checked style, as it must be done by the person who has put side up.
 * I am glad that you could get my php code to work on your site with your plugin.
 * So thanks for the help, but at present I can not do more, because I am very new
   with the more technical setups of WordPress.
 * I just use the JavaScript solution as shown above instead.
 * Thank you very much for your help.
 *  [xyzscripts](https://wordpress.org/support/users/xyzscripts/)
 * (@xyzscripts)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537440)
 * If you could provide the admin access at our [support desk](http://xyzscripts.com/support/),
   we could check this for you
 *  Thread Starter [Erik Oestergaard](https://wordpress.org/support/users/erik-oestergaard/)
 * (@erik-oestergaard)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537441)
 * I am not allowed to provide the admin access to our private real estate homepage
   made for use by all 700 residents.
 * It must just wait to our php programmer (a resident who carry it out in his spare
   time) have the time to look into it. I know that he had made many changes to 
   the theme by himself – and therefore he is the only one, who knows was is changed.
 * But thanks again for your kind offer.
 *  [JosephDJV](https://wordpress.org/support/users/josephdjv/)
 * (@josephdjv)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537448)
 * Hi guys, how can I make XYZ PHP Code dashboard visible to other user roles? For
   example Authors and Editors.
    Thank you
 *  [xyzscripts](https://wordpress.org/support/users/xyzscripts/)
 * (@xyzscripts)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537518)
 * Add capability of user role to manage plugins

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

The topic ‘Generated text output from php-code is placed wrongly.’ is closed to 
new replies.

 * ![](https://ps.w.org/insert-php-code-snippet/assets/icon-128x128.png?rev=1800967)
 * [Insert PHP Code Snippet](https://wordpress.org/plugins/insert-php-code-snippet/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php-code-snippet/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php-code-snippet/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php-code-snippet/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php-code-snippet/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php-code-snippet/reviews/)

## Tags

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

 * 8 replies
 * 3 participants
 * Last reply from: [xyzscripts](https://wordpress.org/support/users/xyzscripts/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/generated-text-output-from-php-code-is-placed-wrongly/#post-6537518)
 * Status: not resolved