first of all: thanks for this wonderful plugin 🙂
I’m quite new to wordpress and I’ve searched quite a lot of boards and documentations for this issue, but without finding an exact answer for my problem.
what I want to do:
1. create two file fields (for txt-files) for every post using simple fields (done! :))
2. the content of the attached txt-files (source code) should be included/displayed in the post (?)
3. the source code from these files should be highlightet using some highlighting-plugin like crayon, geshi-based plugins, … (?)
I have problems displaying the source code in the post.
At the moment (just for testing!!) I have embeded it using an iframe
which is not a real option, of course (but yay, it works…)
$original_code = simple_fields_get_post_value(get_the_id(), array(1, 1), true); $original_code_url = $original_code[url]; echo "<iframe src=$original_code_url></iframe>"; [...]
I also tried using the PHP- readfile and print function, but both didn’t work, probably my bad. Please note that I’m really (!) new to playing around with WordPress-code and PHP in general.
The second issue is the code highlighting.
Those WordPress plugins usually take the pasted code from the editor window before publishing/when editing a post and don’t pull it from an attachment.
Crayon works like this for example:
<pre class="attributes" title="something"> YOUR CODE HERE </pre>
WP-GeSHi-Highlight works more or less the same.
Actually, Crayon can also pull it from a file but it has to be defined whithin the editor window (that is the post’s source code):
<pre class="lang:default decode:true " data-url="http://myurl.com/.../test.txt" ></pre>
But if I incorporate this directly into the theme’s code, it isn’t recoginzed/parsed.
Do you have any hints for me?
Anything would help 🙂
Thank you very much!
- The topic ‘include attached txt-file in post, hightlight the code’ is closed to new replies.