I posted this question on wodpress.stackexchange.com without getting any response.
I realized it could be a programming issue in PHP.
I am trying to publish a blog post into wordpress based website from Microsoft Live Writer. Here is the sample text that I added in Microsoft which I published as well.
" Temporary Blog Post
I am adding a temporary blog post here
Let’s see how it goes
Thanks"
However, when I published the post, this is how it looked
/pI am adding a temporary blog post here
/ppLet’s see how it goes
/ppThanks
Notice the \pp tags which is getting added in text.
Any idea the reason behind the formatting error? I thought when you publish from Microsoft word or Microsoft Live Writer, it should look the same as in the Microsoft Word/Live Writer.
Update : I am having the same error when I am posting from other publishing software like Windows Live Writer etc.
By default, WordPress automatically inserts paragraph tags all over the place when displaying ‘the_content’ – this often gets in the way when you’re trying to space out your text, and also creates validation issues (inserting implicit p tag). If you want to strip the automatically inserted paragraph tags from your content, simply insert this line in your template file above ‘the_content’ tag:
<?php remove_filter (‘the_content’, ‘wpautop’); ?>
OR
Use the cleanup_shortcode_fix() function that should help with your issue.
Check out below links for more information,
Remove the p tags auto wrap
Removing <p> and <br/> tags in WordPress posts
wordpress-wrapping-shortcodes-with-p-tags
Disable wpautop
may this help you.
I found this article which seems to deal with the problem, although its very old so my initial question would be what version of wordpress are you using?
To stop wordpress adding the tags simply add:
remove_filter ('the_content', 'wpautop');
To the top of your functions.php
On a side note I don't use the auto publish features of word, I find cut and pasting a document into Ultimate TinyMCE is the best way to keep your formatting, but thats just my opinion.
Paste it in the notepad first then recopy it from the notepad before pasting it to the wordpress editor.
That should do it.
OR if you dont want to use notepad,
There's a button in the editor that allows you to paste content directly from Word. This removes the special formatting Word uses to lay content out on the page and will make things work well on your site. (The button is in the "Kitchen Sink" on the Visual editor and is circled in the image below.) alt text
Related
You can see on this page: http://oaktreehealth.ca/community/
That the PHP is not rendering out for some reason. I have the same function enabled on most other pages where you see the image in the background at the top of the page.
I'm not sure why all of a sudden it stopped rendering on this page? It was working fine, maybe a wordpress update?. I'm using wooththemes Canvas with a child theme. The only difference with this page is that it is a modified template of the blog template.
The area causing trouble is called in my functions to grab the template part. All other pages do this fine except this one. Any idea?
I'm not entirely sure how to add code in here, but i'm happy to send anything along to help.
The page you've linked, seems to have encoding issues, i believe due to white spaces before the php tag, if you inspect the source, you can see:
��<?php
Check the script corresponding to the following comment (as per the source):
/**
* Template part for Media Feature Area
*/
And try to remove all whitespaces at the beginning and end of the script.
I have a couple of questions related to building a custom theme with Wordpress.
1) If the website is made up of pages, I can use page .php to run the LOOP and retrieve content. In this case, is it OK to paste the content (of each page) using the backend of word press - I.e. paste all content and HTML markup into the 'text; . Is this a reliable way to enter content and accompanying markup into the database?
I guess the advantage is that users will then be able to edit the content themselves using the visual Tab.
Many thanks,
P
Well this not a recommended way to do it, but yes the editor is there for the same purpose. I wont be using it this way, because in my experience wordpress editor often acts weird with html. By default auto paragraphs are enabled, so everything gets in its own paragraph, even if you disable auto paragraph it still has some issues. For instance if you add html in the text tab, and then goto visual tab and switch back to html, and save the same html, this time it would be styled differently. Secondly its also not good to allow users to add html from a security POV and you cant guarentee the consitency of the website.
I would recommend using custom fields instead and fetch these custom fields in the through your theme files.
This post follows research and another recent SO post. That question was along the lines of "Is there a way on any PHP site to identify the file that contains the html that you are viewing on a webpage?" Using, for example "inspect element" feature.
It appears not. Fine. Is there a conventional way around this? From research it seems it's a security issue so with PHP you cannot.
I can login to the host using Filezilla. I want to edit my main Navigation menu. I'd therefore like to search for something like Nav, Navigation, Main menu etc but there does not appear to be a search feature along those lines.
What do developers typically do here (I am very new to PHP). How does one typically identify a file to make edits when they are working on a site that they did not create?
This might help: go into the source and find beginning of the specific piece of HTML generated for your navigation. It might be (I'm not including the closing tag because that might be generated dynamically):
<nav id="main"
or
<ul class="navigation"
Get something like Sublime Text and drag the project folder into it. Then do Find -> Find in Files (Ctrl-Shift-F) and search for that snippet of HTML.
Hopefully you should find what you're looking for.
I'm building a site in Joomla 2.5 that covers topics related to programming.
I have tried various plugins and I had no problem to insert java, javascript and php code inside my articles (the classic view with indented line number)
The problem arises when I try to insert XML.
Currently I'm using the plugin Code HighLight (but I found the same thing with other plugins).
To insert the XML code in my article I have to do so in my article:
{code class="brush: xml;"}CODE HERE{/code}
The problem is that, if I insert Java or Js or php code I have no problem, but if I try to insert XML code in this way in my article it appears bad (parts missing)
I also tried to plug it directly into HTML (by pressing the button HTML editor TinyMCE) but, once inserted, when I come back to the WYSIWING editor, this problem occurs again.
In the plugin instruction I can read:
BEWARE of your visual editor (JCE or JCK for example), it can place tags in your code, after this code became invalid!
I use TinyMCE as editor (it is always a WYSIWYG editor) and seems that this is the problem infact if I disable the graphical editor (inside the Joomla global configuration setting the editor as void) or if I choose the CodeMirror editor (that it is a simple HTML editor, not a WYSIWING editor) if I insert the XML code in te previus way...work well !!!
The problem is that I need a graphical editor (to set the styile of my articles text) and at the same time I need to insert XML code snippet inside my articles...
I have observed that behavior using many code snippet plugin...the problem is not a plugin problem but I think it is related to the WYSIWING editor that seems to insert it's tag inside the XML code or at least makes it dirty (eliminates parts and inserts some tags like )
What can I do to have XML code snippet in my articles and at the same time have a WYSIWING editor? (if the problem is TinyMCE I can also try some other WYSIWING editor...)
Thanks
Andrea
You can give extension for code display a try.
Another solution I read about was
1) activate Content - Code Highlighter (GeSHi)
2) generate your code here
3) C&P the generated code in the WYSIWYG editor
You can do either one or the other...you cannot do both.
My suggestion is this: do the WYSIWYG part of the page...toggle the WYSIWYG editor off...then insert your xml...and NEVER go back to that page with the WYSIWYG editor on again.
I have had the same issues inserting xml in my website.
If you have logged out of joomla and log back in...the default is the WYSIWYG editor.
So if you open an article/module/plugin and it opens in WYSIWYG, it clears the xml that you have inserted into the page. Simply toggle the WYSIWYG editor so that it is off...then CLOSE the article (DO NOT SAVE & CLOSE)...just close. Then open the article/module/plugin again...it should be the html editor only...and code away.
I hope this helps.
I need to insert a google adsense square box in the middle of all articles on the site.
What is the best approach?
The site is in drupal, so I figures I can hook to the view node function. this way the ad won't be saved together with the article. does that make sense? If so, than the question is how do I ensure I won't have image on the other side of the ad (the ad is aligned to the left and should take 50% of the article width)?
should I be using a block? but how will I know to place the block in inside the block.
So in short, I really have no idea where to start to implement it... How is this thing implemented in all the news sites?
I'd approach it by implementing a custom input filter that would insert the AdSense code (or the AdSense module shortcode, if you want) into the processed text. Once you have that custom filter implemented, you'll have to enable it in the text format you're using for the content type.
For implementing a custom filter, take a look at filter_example here.
This solution is for Drupal 7. The solution which worked for me is that I used the adsense tags format and then used this format to show ads on the site. Note that this line doesnot need any js inclusion or script tags. You just need to enable the Adsense tags format(I mean shortcode). Actually I was getting Ads disabled for admin and for other users i was getting the empty ad with space occupied on page but nothing shown. After different tweaks and experiments I got the following code working for me
[adsense:336x280:XXXXXXXXXX]
2nd parameter is width x height
3rd parameter: XXXXXXXXXX denotes the google ad slot/id.
I hope this will help others.
Ata ul Mustafa
I need to insert a google adsense square box in the middle of all articles on the site. What is the best approach?
From my experience:
On some drupal sites I used simply node editor to put box with adsense into content. For websites with not many nodes its best solution because of:
1) Box perfect fits in rest of content - you can change it manually.
2) Total control of viewed boxes - images, flash, text adds etc.
Etc.
But for websites with many nodes, this solution looks like stupid suicide.
Better option will be change node.tpl file in your theme folder. But there is some trouble. In this file, you have $content variable, with contains all of content in this node. This situation gives you ability to put box up or down of this node. But no in the middle. Perhaps solution will be to divide $content into 2x variables which will contains a half of contents. But question is - how do to it? Or maybe while content from node is saved into database, then you can put some html code with adsense box? And search best position to put box by regular expressions? Or maybe change all of nodes by adding html box directly in database?
should I be using a block? but how will I know to place the block in
inside the block.
As I remember, you cannot put block inside another block.