Description formatting
WordPress Event Management, Calendars & Registration › Forums › iCal Extension › Description formatting
This topic contains 11 replies, has 3 voices, and was last updated by Stephen Harris 10 years, 2 months ago.
-
AuthorPosts
-
February 19, 2014 at 12:41 pm #9647
Hi,
the description of the event taken from google calendar loses the text formatting, the sentences are broken up and spread over different lines than the original version, is there any solution?
tks
LucaLuca OssolengoFebruary 19, 2014 at 2:02 pm #9649Hi Luca,
Are you able to provide the iCal feed url? If you don’t wish to make it public, feel free to use the contact form.
Stephen HarrisFebruary 19, 2014 at 3:00 pm #9651Hi Stephen, tks for answer!!
Here you are the iCaL FEED URL:
https://www.google.com/calendar/ical/kq46suka70jhg07hq0b3seceg85600t4%40import.calendar.google.com/public/basic.icsLuca
Luca OssolengoFebruary 19, 2014 at 3:24 pm #9652Hi Luca,
I see what you mean about the styling, but I’m afraid Google isn’t providing that. Looking at the iCal feed, one event for example, has the description:
\n\n♥♥♥ VENERDI 21/02/2014 ♥♥♥\n\n♥♥♥ CELEBRITA' DISCO ♥♥♥\n\n& \n\n♥♥♥ PURA VIDA STAFF ♥♥♥\n\nPresentano:\n\n♥♥♥ SATOSHI TOMIIE ♥♥♥\n\nSat oshi Tomiie (Tokyo\, 22 novembre 1966) è un dj e produttore discografico g iapponese.\nNel 1989 incise un brano di nome Tears. Il brano\, ottenuto con la collaborazione dei due maestri dell'house David Morales e Frankie Knuck les\, lo fece arrivare in brevissimo tempo alle vette delle classifiche del l'house music di tutto il mondo.\nSatoshi Tomiie cominciò la sua carriera p er caso\, quando una casa cosmetica lo incaricò di comporre un brano per il tour promozionale\, offrendogli la possibilità di lavorare con l'allora gi à famoso Frankie Knuckles. Il DJ\, già esperto nel campo\, decise così di i ngaggiarlo per comporre con lui un pezzo house\; fu proprio così che uscì f uori il brano Tears\, che segnò una svolta nell'house music mondiale. Raggi unto il successo\, Satoshi Tomiie continuò (e continua ancora oggi) la sua carriera riscontrando grandi successi e qualificandosi ai primi posti nella classifiche house mondiali.\n\n\ne…in ogni caso…dal secondo in poi\, per t utta la notte\, solo con ★★ 5 € ★★\n\n\n►►► PROGRAMMA SERATA :\n\n► Start H . 23.00\n\n\n\nspecial guest\n\n★★ SATOSHIE TOMIIE★★\n\n\nresident djs\n\n\ n★ LUCA BAX★\n\n★ ANDRE NDR★\n\n★ DAVIDE TEGGI★\n\n★ SNATCH★\n\n\n\nPer Usu fruire delle agevolazioni\, DIRE all' Ingresso:\n\n♥♥♥ LISTA PURA VIDA ♥♥♥\ n\nE avrete il prezzo speciale di:\n\n\n►ingresso DONNA omaggio oppure 13€ 2 drink\n\n►ingresso UOMO 15€ con 1 drink oppure 18€ 2 drink\n\n\n\n\n\n♥♥♥ La Lista rimarrà attiva fino alle ore 01.00 ♥♥♥\n\n\n♥♥♥ SELEZIONE ALL'ING RESSO ♥♥♥\n\n\nSi ricorda inoltre la possibilità di poter prenotare il prop rio TAVOLO :\n\n♥ € 80 con 1 spumante ♥\n♥ € 100 con 1 Champagne ♥\n♥ € 130 con 1 Distillato ♥\n\nPer Qualsiasi informazione:\n\n340.62.62.572 \n340.6 1.24.505 (WhatsApp)\n\n\nVIETATO MANCARE \;)\n\n♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥ ♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
ignoring the truncated lines (which is intentional line folding as per the iCal specification, and automatically corrected), as you can see the content of the event is just text with no styling.
iCal feeds, don’t (in general) contain HTML. According to the specifications, descriptions shouldn’t contain HTML. However, some feeds sometimes provide an ‘alternative representation’ which does contain HTML. If the plug-in recognises that, it uses the HTML representation. However, Google feeds do not appear to do this unfortunately.
Stephen HarrisAugust 27, 2014 at 6:47 pm #12309Is it possible to remove the description altogether? The ical feed I’m using sends info I don’t need in the description, so I would like to just leave it all out if possible.
Brent PeakAugust 28, 2014 at 12:41 am #12310Hi Brent,
Yes there are two ways of doing this. The first is to remove the content from the data that is parsed (via the
eventorganiser_ical_feed_parsed
hook). Please note that this runs for manually imported (i.e. uploaded) feeds as well.function my_remove_event_content_from_feed( $ical_parser ){ if( $ical_parser->events_parsed ){ foreach( $ical_parser->events_parsed as $index => $event ){ $this->events_parsed[$index]['post_content'] = ''; } } } add_action( 'eventorganiser_ical_feed_parsed', 'my_remove_event_content_from_feed' );
(See http://codex.wp-event-organiser.com/hook-eventorganiser_ical_feed_parsed.html for details).
Alternatively there are the
eventorganiser_ical_sync_event_inserted
andeventorganiser_ical_sync_event_updated
actions that run after an event has been created/inserted from an iCal feed. These do not run when manually uploading a feed. A callback attached to these hooks would allow you to update the created/updated event to remove the content.Stephen HarrisAugust 28, 2014 at 1:21 am #12313Thanks for the quick response!
I’m afraid I’m completely lost. Do I just paste the code you provided into the editor somewhere?
Brent PeakAugust 28, 2014 at 1:31 am #12314Hi Brent,
Ideally it should go in a ‘utility plug-in’. But it will also work if you paste it into your functions.php tag. Just make sure it’s inside
<?php ... ?>
tags. (More details can be found here: http://wp-event-organiser.com/blog/tutorial/where-should-i-put-code-from-the-tutorials/).Stephen HarrisAugust 28, 2014 at 8:05 pm #12324I made a utility plug in and uploaded it. I get a parse error:
Parse error: syntax error, unexpected ‘&’ in /home/content/p3nexnas05_data02/24/2102924/html/wp-content/plugins/site-utility.php_/site-utility.php on line 11
Here’s is the file I uploaded:
<?php
/*
Plugin Name: Your Site’s Functionality Plugin
Description: All of the important functionality of your site belongs in this.
Version: 0.1
License: GPL
Author: Your Name
Author URI: yoururl
*/
function my_remove_event_content_from_feed( $ical_parser ){
if( $ical_parser->events_parsed ){
foreach( $ical_parser->events_parsed as $index => $event ){
$this->events_parsed[$index][‘post_content’] = ”;
}
}
}
add_action( ‘eventorganiser_ical_feed_parsed’, ‘my_remove_event_content_from_feed’ );
?>Brent PeakAugust 29, 2014 at 1:01 am #12332Hi Brent,
Copying and pasting that code, I don’t get any error. Which line is line 11 in your editor?
Stephen HarrisAugust 30, 2014 at 6:24 pm #12348This is line 11:
if( $ical_parser->events_parsed ){
Brent PeakSeptember 2, 2014 at 12:26 pm #12366Mmm… there is no
&
. You may want to double check the file.If you’re still not able to resolve that, get in touch via this form or e-mail, with FTP details and I can take a look for you, if you’d like.
Stephen Harris -
AuthorPosts