So I have a wordpress page where I need to paste a block of html code, but when I output using the_content() you know that wp wraps things in <p> and so on, so I want for THAT PAGE to echo out the exact code that I paste in the editor without that auto formmating, is there a function or something, I've searched and found wpautopbut doesn't work.
You can switch from the WYSIWYG-View to the HTML-View by clicking the tab at top right corner of the editor window.
There you can inset your raw code surrounded by <pre> </pre> tags.
If you mean you want code that will execute, and not be seen, then you might try stampede design's solution.
There is also a raw HTML plugin that might help.
Related
In one of my php functions I add some quite simple css. It worked very well until today. Actually the css is still doing his job, but in addition it prints in the middle of my layout whatever is written between the <style></style> tags - in my case it shows .element {display: none !important;} .
My code:
echo'<style>.element {display: none !important;}</style>';
Has there been any update to php or WP that doesn't allow this anymore? Is there any other way to do this?
Thanks a lot for your help!
I am not sure if it might change anything, but can you try print?
Also I think if <style> is not within <head></head> it will not work.
I found a working solution. Previously, I had a function in functions.php, which did some user type specific PHP and also CSS. Now I removed the CSS from functions.php and added it to header.php just before </head>.
The function is in two places now, which I wouldn't prefer, but it works very well.
Still a riddle to me is, how the echo "<style>...</style>"; used to work in functions.php for approx. the last 6 months or so and then suddenly yesterday created mentioned issue.
Btw, I also tried ?><style>...</style><?php and print "<style>...</style>";. All created the same issue. Again, the "<style>" was not shown on the browser, only whatever was inside. Also, the CSS worked. Whatever, statements I entered was interpreted as correct CSS, but in addition also shown as text right between the layout. Here is an example source code at the browser at my example page :
source code at browser
if you wanna to add a custom style to your WordPress theme (that probably you do not design it) its better to add it to custom styles from your admin area.
Is it possible to add a new custom starting tag to recognize PHP code in TextMate on Mac?
i.e. I need to use
[insert_php]
echo "Hello World"
[/insert_php]
Instead of the default code
<?php
echo "Hello World"
?>
I need that because I'm using a WordPress plugin which allows me to insert a custom php code [insert_php] code ... [/insert_php] into posts and pages but it's a bit complected code so I'm using TextMate to write it externally and then will paste it in a WP page .. so the standard PHP styling in TextMate will make my job easier.
Any help will be really appreciated.
You can adjust the grammar definitions for every language. In your case:
Open the Bundle editor
Search for PHP -> Language Grammars -> PHP
Find the block containing name = 'meta.embedded.block.php';, highlighted in this screenshot:
Duplicate it by pressing CTRL+Shift+D
Inside the new block, change begin to '\[insert_php\]'
Change end to '\[/insert_php\]', the result should look like in the second screenshot:
Now your custom begin/end tag should work.
Write your code with <? and ?> then when you're done, replace it with your custom tags. Boom.
I am using the Shareaholic plugin and they give you a block of code to add the sharing buttons anywhere on your site.
[shareaholic app="share_buttons" id="7726121"]
[shareaholic app="recommendations" id="7962129"]
I want to add this code after </article> tag in the file "content-page.php" in Wordpress. When I do it then nothing happens. When I check the page source then I can't find the code anywhere. It happens even when I add some random word after </article> tag.
How can I make this work?
Thanks!
These are short code and you can't call them directly you need to do it like this.
echo do_shortcode('[shareaholic app="share_buttons" id="7726121"]');
echo do_shortcode('[shareaholic app="recommendations" id="7962129"]');
I'm looking for a way where you can write something normal text, ie content / problem for snakes code, for example in [div] [/ div] code could stand without problems where it does not appear or anything,
Therefore I search for a way to make that I can make normal html text but contemporaries do some code if you have problem
right moment, I use tiny mce to make some text, but when I should have known it since I do like this,
<?php echo strip_tags($tekst);?>
how come it appears on the page:
<?php echo \"Hello\";?>
what I want is just here on this page about writing some text and some code to the problem or the like, I'm thinking if I can fix it the same way or look like?
My Wordpress configuration is displaying my content completely stripped off HTML tags on the main page. How do I display HTML tags in my content in this case?
On the post page it's:
<code><!doctype html></code>some text....
But on the main page it's:
<!doctype html>some text.... //For some reasons the tags are removed, why?
This is important because I'm applying styles to the <code> tag and I don't want code look like normal text on the main page.
Thanks in advance
try to wrap it in <code><pre>code here</pre></code>
Are you looking for code highlighters??
Then try out anyone of following plugins:
SyntaxHighlighter
Evolved
WP-Syntax
FV Code
Highlighter
CodeColorer