CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Troubleshoot CiviContribute Widget Code in WordPress
Pages: [1]

Author Topic: Troubleshoot CiviContribute Widget Code in WordPress  (Read 509 times)

getHope

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: WordPress 3.9.2
  • MySQL version: 5.3.28
  • PHP version: 5.5.37
Troubleshoot CiviContribute Widget Code in WordPress
August 25, 2014, 12:40:32 pm
I have been using the CiviContribute widgets on my WordPress website to link donors to campaign pages.  Recently, when I try to edit a WordPress page that contains pasted widget code, WordPress can't open the page.  When I create a new test page and try to past in the widget code, WordPress can paste the code but if I try to re-open the code box there is an unspecified error message.  What to try next in troubleshooting this problem?

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: Troubleshoot CiviContribute Widget Code in WordPress
August 25, 2014, 04:50:53 pm
I think you are saying " I used to be able to do this but I can't any more".

If that is so, then you need to find out what has changed recently as this should help find the source of your problem.  Some of the questions to answer are:
  • Has CiviCRM been upgraded?
  • Has Wordpress been upgraded?
  • Have any of the other plugins/modules in WordPress been upgraded?
  • Have the WordPress theme been changed?
  • Has anything in the hosting environment changed?


getHope

  • I’m new here
  • *
  • Posts: 2
  • Karma: 0
  • CiviCRM version: 4.4.4
  • CMS version: WordPress 3.9.2
  • MySQL version: 5.3.28
  • PHP version: 5.5.37
Re: Troubleshoot CiviContribute Widget Code in WordPress
September 01, 2014, 08:11:12 am
I have not updated CiviCRM or WordPress in the last three months.  I have gone through the existing plugins and deactivated the majority of them, one at a time, and haven't found one that seems to be interfering. 

I contacted my hosting provider (CiviHost) and it does not appear that any changes were made on their end.

What to try next?

SandraC

  • I post occasionally
  • **
  • Posts: 32
  • Karma: 0
  • CiviCRM version: 4.4.5
  • CMS version: WordPress 4.0
  • MySQL version: 5.5.30
  • PHP version: 5.3.20
Re: Troubleshoot CiviContribute Widget Code in WordPress
December 01, 2014, 07:52:56 pm
Did you ever get the widget to work in WordPress. I just tried to make one for a campaign, and when I paste the code in WP text view, it is there, but when I view it in Visual view, it just says placeholder...
<3

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Troubleshoot CiviContribute Widget Code in WordPress
December 02, 2014, 03:57:40 am
SandraC: I've just tested the widget and can confirm that without some manipulation, it will fail on WordPress. The reason for this is that WordPress applies `wp_autop()` formatting to the content of the post/page - and this includes to the widget code - thus inserting paragraph tags where they kill the execution of the javascript and mess with the CSS declarations.

I could get the widget to work if I removed all empty lines in the widget code. You may have to switch from the visual editor to the plain text editor to accomplish this successfully.

However, if you're working on WordPress multisite this won't be enough since multisite does not allow the content to include scripts and/or arbitrary HTML. In this instance a native WordPress widget will be required to do the conversion at runtime.

I'm opening a Jira issue and pull request to solve the short-term issue of the empty lines.

haystack

  • I post occasionally
  • **
  • Posts: 61
  • Karma: 2
  • CiviCRM version: 4.n
  • CMS version: WordPress 4.n
  • MySQL version: 5.n
  • PHP version: 5.n
Re: Troubleshoot CiviContribute Widget Code in WordPress
December 02, 2014, 04:02:01 am
Quote from: SandraC on December 01, 2014, 07:52:56 pm
when I paste the code in WP text view, it is there, but when I view it in Visual view, it just says placeholder...

I can confirm this too - WordPress strips the style declarations when you switch to the Visual Editor. The only solution (apart from the native widget that I mentioned previously) is not to switch away from the Plain Text Editor before you save the page/post.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Troubleshoot CiviContribute Widget Code in WordPress

This forum was archived on 2017-11-26.