Jump to content

Using Trumba with WordPress


iwork2ski

Recommended Posts

I have tried the main calendar spud in a Wordpress blog. No luck.

 

This works....

 

<script type="text/javascript" src="

//www.trumba.com/k.aspx?calendar=ie_MY_CALENDAR"></script>

 

But this doesn't (copied from the Trumba Publish Control Panel)....

<script type="text/javascript" src="//www.trumba.com/scripts/spuds.js"></script>
<script type="text/javascript">
$Trumba.addSpud({
webName: "ie_MY_CALENDAR",
spudType : "main" });
</script>

Link to comment
Share on other sites

Looking at the source code made it easy to see the reason the spuds in the new spud code aren't displaying. What is happening is that, at least in this case, WordPress is interpreting the spud code between the opening and closing script tags as regular text and converting it to HTML. So, for example, this spud code:

webName: "yourcalwebname"
spudType: "main"

might look like this if you open the page you created in WordPress in a browser and then view the source code:

webName: &#8220;yourcalwebname&#8221;,<br />
spudType : &#8220;main&#8221; });<br />

The HTML code conversion invalidates the spud code, so there is no spud in your page for the browser to display. This also can explain why you can get the older spud code to work. The older code includes the instructions for displaying the spud as an attribute inside of the opening script tag, so it's not being treated as normal text. The new spud code uses a different syntax, though, so it's always going to have text between the opening and closing script tags.

Link to comment
Share on other sites

Javascript in Posts

To use Javascript inside of posts in WordPress, you need to take a few more steps. Odds are that this usage is for one or only a few instances, so adding the script to the header would be unnecessary.

For the occasional or one time use of Javascript, you need to put the script into a Javascript file and then call it out from within the post. Make sure that each script is defined by its function name such as:

function updatepage(){var m="Page updated "+document.lastMo.......}

To include a Javascript inside a post, you need to combine both the call to the script file with the call to the Javascript itself.

<script type="text/javascript" src="/scripts/updatepage.js"></script>
<script type="text/javascript">
<!--
updatepage();
//--></script>

If the src attribute of your javascript tag is being stripped out you need to turn off the rich editor (from the dashboard go to Users > Personal Options). If you are using the rich editor the javascript tag's src attribute may be stripped out even when manually editing in the HTML popup window.

Link to comment
Share on other sites

The info you posted from the WordPress Codex is promising, but it turns out that it applies only if you've downloaded the WordPress software from wordpress.org and set it up on your own host. If you do that, you have much more control over the code behind the scenes.

If you have WordPress host your blog (which is what I did), javascript isn't supported. I checked out their forums, too, and answers to questions about javascript are repeatedly along the lines of, "it's not supported, period." This is for security reasons, to keep people from being able to hack into others' blogs or worse. They talk about it all on their site.

Anyway, I got some helpful info from one of their support people, explaining the difference between wordpress.org and wordpress.com in case you or anyone else is interested: FAQ about wordpress options

Link to comment
Share on other sites

  • 4 years later...

Here is a tip on using Trumba with Word Press that I wanted to pass along.

One way to get around WP’s non-support of Javascript is to create an include and/or HTMLl file that has just the code they require for the instance of the calendar (which can be as much as an entire “page” with tables, calendar spud, control spud, and then place it on your own web server. On the template page you can created in Word Press,  use iFrames to reference the file and pull it into WordPress by this means.

Here is the iFrame code they used in the WP page template:

<iframe frameborder="0" style="width:750px;height:1200px" src="https://www.trumba.com/calendars/trumbau" scrolling="auto"></iframe>

Link to comment
Share on other sites

  • 5 weeks later...

Surprisingly, it just worked for me to paste the main spud code right into a page. It also worked to put a promotion spud's code into the Text sidebar widget. 

I'm on WP version 3.0.4, and to clarify, with an installation from .org and have full admin access to the files and server.

The WordPress content management system (CMS) works well with Trumba® to provide your site visitors access to Trumba's highly customizable calendars (and other spuds) and promote your new events. Here is a help topic with more information: https://www.trumba.com/help/publish/pub_wordpress.aspx

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...