Description formatting

This topic contains 11 replies, has 3 voices, and was last updated by  Stephen Harris 9 years, 7 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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
    Luca

    Luca Ossolengo
    #9649

    Hi 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 Harris
    #9651
    Luca Ossolengo
    #9652

    Hi 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 Harris
    #12309

    Is 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 Peak
    #12310

    Hi 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 and eventorganiser_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 Harris
    #12313

    Thanks for the quick response!

    I’m afraid I’m completely lost. Do I just paste the code you provided into the editor somewhere?

    Brent Peak
    #12314

    Hi 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 Harris
    #12324

    I 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 Peak
    #12332

    Hi Brent,

    Copying and pasting that code, I don’t get any error. Which line is line 11 in your editor?

    Stephen Harris
    #12348

    This is line 11:

      if( $ical_parser->events_parsed ){
    Brent Peak
    #12366

    Mmm… 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
Viewing 12 posts - 1 through 12 (of 12 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.