
ACTUAL NEWS FRONT 2018 (SOLO 3)
ROLLO PUERTAS SANTI
Snippet options
Download: Download snippet as actual-news-front-2018-solo-3.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!
function actualnews_front_function( $atts ){ $idioma = pll_current_language(); $nick="puertassanti"; $website = "http://www.puertassanti.com/"; $contanots = 0; if($idioma=='ca'){ $lenguaje="cat"; $vermas="Lleguir més"; $slugan ="noticia-cat"; } elseif ($idioma=='fr') { $lenguaje=""; $vermas=""; $slugan =""; } elseif($idioma=='en') { $lenguaje="eng"; $vermas="View more"; $slugan ="news"; } else { $lenguaje="esp"; $vermas="Leer más"; $slugan ="noticia"; } ?> <style> .overlayertitulo { display: block; position: absolute; bottom: -10px; left: 0px; width: 370px; background-color: rgba(0,0,0,0.5); z-index: 10000; height: 60px; margin-left: 15px; } .vc_custom_1513787034273 { margin-left: 15px !important; } .vc_custom_1513785288579 { margin-bottom: -70px !important; } .vc_custom_1513787373830 { margin-bottom: -85px !important; } .vc_custom_1513787385112 { margin-bottom: -85px !important; } .vc_custom_1513787014521 { margin-bottom: 0px !important; margin-left: 15px !important; } .vc_custom_1513787022025 { margin-bottom: 0px !important; margin-left: 15px !important; } .vc_custom_1513787006386 { margin-bottom: 0px !important; margin-left: 15px !important; } .vc_custom_1513787055115 { margin-left: 15px !important; } .vc_custom_1513787041747 { margin-left: 15px !important; } </style> <?php $url='http://www.actualnews.es/zona_clients/rss_complet.php?nick='.$nick.'&lang='.$lenguaje.'&contingut=llarg&l=3'; $xml = simplexml_load_file($url); $xml2 = json_decode(json_encode($xml->noticies) , true); // SOLO PARA DEBUG //echo "<pre>"; print_r($xml2);echo "</pre>"; //echo "<pre>"; print_r($idioma);echo "</pre>"; //echo "<pre>"; print_r($url); echo "</pre>"; //echo "<pre>"; echo count($xml2['noticia']); echo "</pre>"; //echo "<pre style='font-size:8px;''>"; print_r($noticia); echo "</pre>"; //////////////////// $idNoticia1 = $xml2['noticia']['0']['idNoticia']; $title1 = $xml2['noticia']['0']['title']; if (strlen($title)>60){ $title1 = trim(substr($title1, 0, 50))." ... "; } $description1 = $xml2['noticia']['0']['description']; $description_sintag1= strip_tags($description1); $desc_curt1 = trim(substr($description_sintag1, 0, 120))."..."; $data1 = strftime("%d-%b-%Y", strtotime($xml2['noticia']['0']['data'])); $partes1 = explode("-", $data1); $ano1 = $partes1[0]; $mes1 = $partes1[1]; $dia1 = $partes1[2]; $imatge_principal1 = $xml2['noticia']['0']['imatge_principal']; $url1=$website.$slugan."/".$idNoticia1."/".sanitize_title($title1); $activa1=$xml2['noticia']['0']['actiu']; $idNoticia2 = $xml2['noticia']['1']['idNoticia']; $title2 = $xml2['noticia']['2']['title']; if (strlen($title2)>60){ $title2 = trim(substr($title2, 0, 50))." ... "; } $description2 = $xml2['noticia']['1']['description']; $description_sintag2= strip_tags($description2); $desc_curt2 = trim(substr($description_sintag2, 0, 120))."..."; $data2 = strftime("%d-%b-%Y", strtotime($xml2['noticia']['1']['data'])); $partes2 = explode("-", $data2); $ano2 = $partes2[0]; $mes2 = $partes2[1]; $dia2 = $partes2[2]; $imatge_principal2 = $xml2['noticia']['1']['imatge_principal']; $url2=$website.$slugan."/".$idNoticia2."/".sanitize_title($title2); $activa2=$xml2['noticia']['1']['actiu']; $idNoticia3 = $xml2['noticia']['2']['idNoticia']; $title3 = $xml2['noticia']['2']['title']; if (strlen($title3)>60){ $title3 = trim(substr($title3, 0, 50))." ... "; } $description3 = $xml2['noticia']['2']['description']; $description_sintag3= strip_tags($description3); $desc_curt3 = trim(substr($description_sintag3, 0, 120))."..."; $data3 = strftime("%d-%b-%Y", strtotime($xml2['noticia']['2']['data'])); $partes3 = explode("-", $data3); $ano3 = $partes3[0]; $mes3 = $partes3[1]; $dia3 = $partes3[2]; $imatge_principal3 = $xml2['noticia']['2']['imatge_principal']; $url3=$website.$slugan."/".$idNoticia3."/".sanitize_title($title3); $activa3=$xml2['noticia']['2']['actiu']; ?> <div class="vc_row wpb_row vc_inner vc_row-fluid"> <div class="wpb_column vc_column_container vc_col-sm-8"> <div class="vc_column-inner "> <div class="wpb_wrapper"> <div class="wpb_single_image wpb_content_element vc_align_left vc_custom_1513785288579"> <figure class="wpb_wrapper vc_figure"> <div class="vc_single_image-wrapper vc_box_border_grey"> <a href="<?php echo $url1; ?>"> <img src="<?php echo $imatge_principal1; ?>" class="vc_single_image-img attachment-full" alt="" srcset="<?php echo $imatge_principal1; ?> 750w, <?php echo $imatge_principal1; ?> 300w, <?php echo $imatge_principal1; ?> 24w, <?php echo $imatge_principal1; ?> 36w, <?php echo $imatge_principal1; ?> 48w" sizes="(max-width: 750px) 100vw, 750px" width="750" height="433"> </a> </div> </figure> </div> <h2 style="font-size: 10px;color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787006386"> <?php echo $data1; ?> </h2> <h2 style="color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787034273"> <a href="<?php echo $url1; ?>"><?php echo $title1; ?></a> </h2> </div> </div> </div> <div class="wpb_column vc_column_container vc_col-sm-4"> <div class="vc_column-inner "> <div class="wpb_wrapper"> <div class="wpb_single_image wpb_content_element vc_align_left vc_custom_1513787373830"> <figure class="wpb_wrapper vc_figure"> <div class="vc_single_image-wrapper vc_box_border_grey"> <a href="<?php echo $url2; ?>"> <img src="<?php echo $imatge_principal2; ?>" class="vc_single_image-img attachment-full" alt="" srcset="<?php echo $imatge_principal2; ?> 750w, <?php echo $imatge_principal2; ?> 300w, <?php echo $imatge_principal2; ?> 24w, <?php echo $imatge_principal2; ?> 36w, <?php echo $imatge_principal2; ?> 48w" sizes="(max-width: 750px) 100vw, 750px" width="750" height="433"> </a> </div> </figure> </div> <h2 style="font-size: 10px;color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787014521"> <?php echo $data2; ?> </h2> <h2 style="font-size: 20px;color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787041747"> <a href="<?php echo $url; ?>"><?php echo $title2; ?></a> </h2> <div class="vc_empty_space" style="height: 15px"><span class="vc_empty_space_inner"></span></div> <div class="wpb_single_image wpb_content_element vc_align_left vc_custom_1513787385112"> <figure class="wpb_wrapper vc_figure"> <div class="vc_single_image-wrapper vc_box_border_grey"> <a href="<?php echo $url3; ?>"> <img src="<?php echo $imatge_principal3; ?>" class="vc_single_image-img attachment-full" alt="" srcset="<?php echo $imatge_principal3; ?> 750w, <?php echo $imatge_principal3; ?> 300w, <?php echo $imatge_principal3; ?> 24w, <?php echo $imatge_principal3; ?> 36w, <?php echo $imatge_principal3; ?> 48w" sizes="(max-width: 750px) 100vw, 750px" width="750" height="433"> </a> </div> </figure> </div> <h2 style="font-size: 10px;color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787022025"> <?php echo $data3; ?> </h2> <h2 style="font-size: 20px;color: #ffffff;text-align: left;font-family:Raleway;font-weight:400;font-style:normal" class="vc_custom_heading txtnews vc_custom_1513787055115"> <a href="<?php echo $url3; ?>"><?php echo $title3; ?></a> </h2> </div> </div> </div> </div> <?php } add_shortcode( 'actualnews_front', 'actualnews_front_function' );
Create a free my code stock.com account now.
my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!
Find out more and register nowYou can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.