Title: wp-syntax outside the loop
Last modified: August 22, 2016

---

# wp-syntax outside the loop

 *  [noobeeee](https://wordpress.org/support/users/noobeeee/)
 * (@noobeeee)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/wp-syntax-outside-the-loop/)
 * hi,
 * I want to implement the following feature:
 * each post has an attachment (e.g. .txt). Tts content is displayed below each 
   post and highlighted through WP-Syntax.
 * Pulling the file’s contents, reading it into a string and displaying it is no
   problem.
    But I’m afraid I can’t run it through the WP-Syntax plugin if it’s 
   outside the post or comments.
 * In the plugin’s code, there’s this filter-section which could have to do with
   my issue
 *     ```
       // We want to run before other filters; hence, a priority of 0 was chosen.
       			// The lower the number, the higher the priority.  10 is the default and
       			// several formatting filters run at or around 6.
       			add_filter( 'the_content', array( __CLASS__, 'beforeFilter' ), 0);
       			add_filter( 'the_excerpt', array( __CLASS__, 'beforeFilter' ), 0);
       			add_filter( 'comment_text', array( __CLASS__, 'beforeFilter' ), 0);
       			add_filter( 'comment_text', array( __CLASS__, 'beforeFilter' ), 0);
       ```
   
 * My code for reading the files contents is in a template-file.
 * Can you add an additional filter so WP-Syntax also recognizes if theres
 * `<pre lang="php"> [...] </pre>` written somewhere in the template’s code?
 * I’ve tried registering my own shortcodes but that also doesn’t run it through
   WP-Syntax.
    I’ve also tried highlighting the code just by calling the included
   geshi.php, which worked. But I would like to have it all parsed through the WP-
   Syntax plugin (all highlighted code looking the same)
 * I’m really thankful for any advice!
 * [https://wordpress.org/plugins/wp-syntax/](https://wordpress.org/plugins/wp-syntax/)

The topic ‘wp-syntax outside the loop’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-syntax_f8f6f6.svg)
 * [WP-Syntax](https://wordpress.org/plugins/wp-syntax/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-syntax/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-syntax/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-syntax/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-syntax/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-syntax/reviews/)

## Tags

 * [attachment](https://wordpress.org/support/topic-tag/attachment/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [outside](https://wordpress.org/support/topic-tag/outside/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 0 replies
 * 1 participant
 * Last reply from: [noobeeee](https://wordpress.org/support/users/noobeeee/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/wp-syntax-outside-the-loop/)
 * Status: not resolved