Title: Triggering text block from functions.php does not work
Last modified: June 7, 2018

---

# Triggering text block from functions.php does not work

 *  [eddypiv](https://wordpress.org/support/users/eddypiv/)
 * (@eddypiv)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/triggering-text-block-from-functions-php-does-not-work/)
 * Hi,
 * I need a text block to be executed when a single post is displayed in the frontend.
   Same text block for each post.
 * Background.
    In my website, members can fill out an extensive profile which is
   set up with the Meta Blocks plugin. The members enter their info in the frontend.
   Some general information they enter is stored in a post, but the majority of 
   info is stored in Meta Block fields. These fields are not shown in the frontend,
   so therefore I am using a reusable textblock that is added to each post. In this
   text block each field is derived from the database and displayed in the order
   and layout I want. I currently manually add this text block at the end of each
   post: [text-blocks id=”showfields”]
 * So far so good.
    This works perfectly, but… instead of adding the shortcode manually
   to each post (after my member has filled out his info in the frontend), I want
   the text block to be automatically executed before the post is displayed in the
   frontend.
 * Therefore I have added to the functions.php:
    add_filter( ‘the_content’, function(
   $content ) { if ( is_single() ) { $content .= do_shortcode( ‘[text-blocks id=”
   showfields”]’ ); } return $content; } );
 * The result is a 503 Service Unavailable error.
    When I deactivate your plugin,
   the shortcode [text-blocks id=”showfields”] is shown in the frontend. Hence, 
   the functions.php seem to work, but the execution of the text block does not 
   work.
 * My question:
    How can I trigger the reuasable text block through the functions.
   php?
    -  This topic was modified 7 years, 11 months ago by [eddypiv](https://wordpress.org/support/users/eddypiv/).

The topic ‘Triggering text block from functions.php does not work’ is closed to 
new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/reusable-text-blocks_53c8f2.svg)
 * [Reusable Text Blocks](https://wordpress.org/plugins/reusable-text-blocks/)
 * [Support Threads](https://wordpress.org/support/plugin/reusable-text-blocks/)
 * [Active Topics](https://wordpress.org/support/plugin/reusable-text-blocks/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/reusable-text-blocks/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/reusable-text-blocks/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [eddypiv](https://wordpress.org/support/users/eddypiv/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/triggering-text-block-from-functions-php-does-not-work/)
 * Status: not resolved