04 - WOO Templates Oxygenados json

View Snippet
                    {"component":{"id":430,"name":"ct_section","options":{"ct_id":430,"ct_parent":100026,"selector":"section-430-555","original":{"container-padding-bottom":"71"},"nicename":"Section (#430)","activeselector":""},"depth":4,"children":[{"id":431,"name":"ct_code_block","options":{"ct_id":431,"ct_parent":430,"selector":"code_block-431-555","original":{"code-php":"<!-------->","code-css":".woo4-container:hover .woo4-background{\n  transform: scale(1.1);\n}\n.woo4-container_precios{\n  display:flex;\n  flex-direction: row;\n  align-items: center;\n  justify-content: center;\n  gap: 20px;\n  font-size: 20px;\n  font-weight: 500;\n  font-family: 'Poppins';\n}\n.woo4-precio_normal{\n  font-size: 16px;\n  font-weight: 400;\n  text-decoration:line-through;\n  color: rgba(0,0,0, .5);\n}\n.woo4-descuento{\n  display:flex;\n  flex-direction: row;\n  gap: 10px;\n  background: #f97639;\n  padding: 6px 12px;\n  align-items:center;\n  justify-content: center;\n  font-family: 'Poppins';\n  height:50px;\n  position: absolute;\n  top: 15px;\n  left: -60px;\n  min-width: 200px;\n  color: #ffffff;\n  font-weight: 500;\n  font-size: 15px;\n  transform: rotate(-45deg);\n /*transition: .7s cubic-bezier(0.21, 0.45, 1, 0.78);*/\n}","code-js":"document.addEventListener('DOMContentLoaded',()=>{\n    const divAs = document.querySelectorAll('.woo4-container'),\n        divBs= document.querySelectorAll('.woo4-background'),\n        divDs = document.querySelectorAll('div[data-imgs]')\n    let ant, nuv\n\n    divAs.forEach((d, index)=>{\n        d.addEventListener('mouseover', ()=>{\n            ant = divBs[index].style.backgroundImage\n            nuv = divDs[index].dataset.imgs\n            divBs[index].style.backgroundImage = `url(${nuv})`\n\n        })\n        d.addEventListener('mouseout', ()=>{\n            divBs[index].style.backgroundImage = ant\n        })\n    })\n})"},"nicename":"Code Block (#3)"},"depth":5},{"id":432,"name":"oxy_dynamic_list","options":{"ct_id":432,"ct_parent":430,"selector":"_dynamic_list-432-555","original":{"wp_query_advanced_preset":"Custom Settings","wp_query_advanced":[{"key":"post_type","values":[{"value":"product"}]},{"key":"posts_per_page","values":[{"value":"4"}]},{"key":"no_found_rows","values":[{"value":"true"}]},{"key":"orderby","values":[{"value":"date"}]}],"display":"grid","grid-column-count":"4","wp_query":"advanced"},"nicename":"Repeater (#3)"},"depth":5,"children":[{"id":433,"name":"ct_div_block","options":{"ct_id":433,"ct_parent":432,"selector":"div_block-433-555","original":{"padding-top":"0","padding-right":"0","padding-left":"0","margin-top":"0","margin-right":"0","margin-left":"0","overflow":"hidden","margin-bottom":"0"},"nicename":"Div (#4)"},"depth":6,"children":[{"id":434,"name":"ct_div_block","options":{"ct_id":434,"ct_parent":433,"selector":"div_block-434-555","original":{"padding-bottom":"20","position":"relative"},"nicename":"woo4-container","classes":["woo4-container"]},"depth":7,"children":[{"id":435,"name":"ct_div_block","options":{"ct_id":435,"ct_parent":434,"selector":"div_block-435-555","original":{"width":"100","width-unit":"%","max-height-unit":"%","height":"100","height-unit":"%","overflow":"hidden"},"nicename":"Div Imagen"},"depth":8,"children":[{"id":436,"name":"ct_div_block","options":{"ct_id":436,"ct_parent":435,"selector":"div_block-436-555","original":{"background-image":"[oxygen ct_sign_sha256='edb5b3d8272dea5067ab4354be942b486e8d478c795de1750b02157f1cbd6bde' data='featured_image' ]","background-imagedynamic":true,"background-size":"contain","background-repeat":"no-repeat","background-position-left-unit":" ","background-position-left":"center","background-position-top-unit":" ","background-position-top":"center"},"nicename":"woo4-background","classes":["woo4-background"],"activeselector":false},"depth":9}]},{"id":437,"name":"ct_div_block","options":{"ct_id":437,"ct_parent":434,"selector":"div_block-437-555","original":{"flex-direction":"column","display":"flex","text-align":"left","align-items":"center","gap":"5","justify-content":"space-between","width":"100","width-unit":"%","height":"100","height-unit":"%"},"nicename":"Div (#160)"},"depth":8,"children":[{"id":438,"name":"ct_div_block","options":{"ct_id":438,"ct_parent":437,"selector":"div_block-438-555","original":{"text-align":"left","align-items":"center"},"nicename":"Div (#284)","activeselector":""},"depth":9,"children":[{"id":439,"name":"ct_headline","options":{"ct_id":439,"ct_parent":438,"selector":"headline-439-555","original":{"tag":"h4","font-size":"16","text-align":"center","width":"100","width-unit":"%","padding-left":"5","padding-right":"5","color":"rgba(0,0,0,0.51)"},"nicename":"Heading (#32)","ct_content":"<span id=\"ct-placeholder-440\"></span>"},"depth":10,"children":[{"id":440,"name":"ct_span","options":{"ct_id":440,"ct_parent":439,"selector":"span-440-555","original":[],"nicename":"Span (#39)","ct_content":"[oxygen ct_sign_sha256='e7b83ec3eefe48eb981b34e53e9b27a331e55e04bb3b90b7165f98478e10a2eb' data='title' ]"},"depth":11}]},{"id":441,"name":"ct_code_block","options":{"ct_id":441,"ct_parent":438,"selector":"code_block-441-555","original":{"unwrap":"false","code-php":"<?php\n  $cates = wp_get_post_terms( get_the_ID(), 'product_cat' ); // Obtén las categorías del producto\n  $link_cates = array();\n  foreach ( $cates as $cate ) {\n      $enlace = get_term_link( $cate );\n      $link_cates[] = '<a class=\"woo4-link_cate\" href=\"' . $enlace . '\">' . $cate->name . '</a>';\n  }\n  echo '<div class=\"woo4-div-cates\">' .implode( ', ', $link_cates ).'</div>'; \n?>"},"nicename":"Categorias"},"depth":10},{"id":442,"name":"ct_text_block","options":{"ct_id":442,"ct_parent":438,"selector":"text_block-442-555","original":{"tag":"p","custom-css":"","width":"80","width-unit":"%"},"nicename":"Text (#286)","ct_content":"<span id=\"ct-placeholder-443\"></span>"},"depth":10,"children":[{"id":443,"name":"ct_span","options":{"ct_id":443,"ct_parent":442,"selector":"span-443-555","original":{"custom-css":"  display: -webkit-box;\n  -webkit-line-clamp: 3;\n  -webkit-box-orient: vertical;  \n  overflow: hidden;"},"nicename":"Span (#292)","ct_content":"[oxygen ct_sign_sha256='7e49c0bbe33d521f367719cf51635e5d880cad0f8dd0ff08fabfd782f554e45e' data='excerpt' ]"},"depth":11}]}]},{"id":444,"name":"ct_div_block","options":{"ct_id":444,"ct_parent":437,"selector":"div_block-444-555","original":{"width":"100","width-unit":"%","flex-direction":"column","display":"flex","align-items":"center","gap":"20"},"nicename":"Div (#298)"},"depth":9,"children":[{"id":445,"name":"ct_code_block","options":{"ct_id":445,"ct_parent":444,"selector":"code_block-445-555","original":{"code-php":"<?php\n$laId = get_the_ID();\n\n$precNormal = get_post_meta( $laId, '_regular_price', true ); \n$precOferta = get_post_meta( $laId, '_sale_price', true ); \n$precio = get_post_meta( $laId, '_price', true ); \n$sale_start_date = get_post_meta( $laId, '_sale_price_dates_from', true ); \n$sale_end_date = get_post_meta( $laId, '_sale_price_dates_to', true ); \n$moneda = get_woocommerce_currency_symbol();\n\n$imGids = get_post_meta( $laId, '_product_image_gallery', true );\n$nombre = get_the_title($laId);\n\nif ( $imGids ) {\n    $imgId = explode( ',', $imGids )[0];\n    $imgId = wp_get_attachment_image_url( $imgId);\n}else{\n   $imagen_destacada_src = wp_get_attachment_image_src(get_post_thumbnail_id($laId), 'full');\n   $imgId = $imagen_destacada_src[0];\n}\n?>\n<div class=\"woo4-container_precios\">\n\n<?php \n if( $precOferta > 0) {\n  $porcent = '-'.ceil(($precNormal - $precOferta) / $precOferta * 100) .'%';\n  echo '<div class=\"woo4-descuento\">'.$porcent.'</div>';\n  echo '<div class=\"woo4-precio_normal\">'. $precNormal .'<span class=\"woo4-span_moneda\">'.$moneda. '</span></div>'; \n }\n  \n?>\n  <div class=\"woo4-precio_desc\" data-imgs=\"<?php echo $imgId; ?> \">\n      <?php echo  $precio .'<span class=\"woo4-span_moneda\">'.$moneda. '</span>'; ?>\n  </div> \n\n</div> <!---- Final precios -->\n","width-unit":"%","padding-top":"0"},"nicename":"Oferta"},"depth":10},{"id":446,"name":"ct_link_text","options":{"ct_id":446,"ct_parent":444,"selector":"link_text-446-555","original":{"url":"[oxygen ct_sign_sha256='ffa65a501b96d267bece4ca43bc8d0135243cce91f395563019f55f46d41b78b' data='permalink' ]","font-family":"Roboto","color":"#ffffff","hover_color":"#f97639","font-size":"20","background-color":"#f97639","width-unit":"%","width":"80","text-align":"center","border-radius":"5","transition-duration":".5","border-top-color":"#f97639","border-right-color":"#f97639","border-bottom-color":"#f97639","border-left-color":"#f97639","border-all-color":"#f97639","border-top-width":"1","border-right-width":"1","border-bottom-width":"1","border-left-width":"1","border-all-width":"1","border-top-style":"solid","border-right-style":"solid","border-bottom-style":"solid","border-left-style":"solid","border-all-style":"solid"},"nicename":"Text Link (#271)","ct_content":"Ver Producto","classes":[],"hover":{"color":"#f97639","border-top-color":"#f97639","border-right-color":"#f97639","border-bottom-color":"#f97639","border-left-color":"#f97639","border-all-color":"#f97639","background-color":"#ffffff","transition-duration":".5"}},"depth":10}]}]}]}]}]}]},"classes":{"woo4-container":{"key":"woo4-container","original":{"width-unit":"%","overflow":"hidden","flex-direction":"column","display":"flex","align-items":"center","border-top-color":"rgba(0,0,0,0.26)","border-right-color":"rgba(0,0,0,0.26)","border-bottom-color":"rgba(0,0,0,0.26)","border-left-color":"rgba(0,0,0,0.26)","border-all-color":"rgba(0,0,0,0.26)","border-top-width":"1","border-right-width":"1","border-bottom-width":"1","border-left-width":"1","border-all-width":"1","border-top-style":"solid","border-right-style":"solid","border-bottom-style":"solid","border-left-style":"solid","border-all-style":"solid","border-top-left-radius":"5","border-top-right-radius":"5","width":"100","justify-content":"space-between","height":"560"},"hover":{"box-shadow-color":"rgba(0,0,0,0.2)","box-shadow-horizontal-offset":"0","box-shadow-vertical-offset":"0","box-shadow-blur":"3","box-shadow-spread":"2"}},"woo4-background":{"key":"woo4-background","original":{"width-unit":"%","background-position-left-unit":" ","background-position-top-unit":" ","background-imagedynamic":"1","width":"100","height":"300","transition-duration":".5","padding-top":"0","padding-right":"0","padding-bottom":"0","padding-left":"0","margin-top":"0","margin-right":"0","margin-bottom":"0","margin-left":"0","background-image":"[oxygen data='featured_image']"},"activeselector":{}}}}
                  

SacoWeb javascript

View Snippet
                    document.addEventListener("DOMContentLoaded", () => {
	const logoDos = "/wp-content/uploads/2023/10/SACO-logo.png",
		idiomas = ["en-us", "es-mx"],
		textos = ["US", "PROJECTS", "SPACE", "CONTACT"],
		txtLinks = document.querySelectorAll(".header-link"),
		icoOpen = document.querySelector(".icono-open-menu"),
		icoClose = document.querySelector(".icono-cierra-menu"),
		secMenu = document.querySelector(".secc-menu"),
		divHea = document.querySelector(".div-header"),
		divIdi = document.querySelector(".div-idiomas"),
		logoImg = document.querySelector(".logo-img"),
		logImSrc = logoImg.src;

	icoOpen.addEventListener("click", (ele) => {
		secMenu.classList.add("header-movido");
	});

	icoClose.addEventListener("click", (ele) => {
		secMenu.classList.remove("header-movido");
	});

	controlL = (l) => {
		let encontrado = false;
		for (let i = 0; i < idiomas.length; i++) {
			if (location.pathname.includes(idiomas[i])) {
				l[i + 1].classList.add("lang-activo");
				encontrado = true;
			}
		}
		if (!encontrado) l[0].classList.add("lang-activo");

		if (encontrado) {
			let bUri = location.pathname.substring(1, 6);
			logoImg.parentElement.href = logoImg.parentElement.href + bUri;
			if (location.pathname.includes("/en-us/"))
				for (let i = 0; i < txtLinks.length; i++) {
					txtLinks[i].innerText = textos[i];
					txtLinks[i].href = "/en-us/" + textos[i].toLowerCase();
				}
		}
	};

	manLinks = () => {
		const heLinks = document.querySelectorAll(".header-link"),
			linEs = document.createElement("a"),
			linUs = document.createElement("a"),
			linMx = document.createElement("a");

		linEs.href = "/";
		linEs.className = "link-lang";
		linEs.textContent = "ES";
		linUs.href = "/en-us/";
		linUs.className = "link-lang";
		linUs.textContent = "US";
		linMx.href = "/es-mx/";
		linMx.className = "link-lang";
		linMx.textContent = "MX";
		linksL = document.querySelectorAll(".link-lang");

		if (linksL.length > 0)
			for (let i = 0; i < linksL.length; i++) linksL[i].parentNode.removeChild(linksL[i]);

		if (screen.width < 768) {
			divHea.appendChild(linEs);
			divHea.appendChild(linUs);
			divHea.appendChild(linMx);
			linEs.classList.add("link-lang-respon");
			linUs.classList.add("link-lang-respon");
			linMx.classList.add("link-lang-respon");
		} else {
			divIdi.appendChild(linEs);
			divIdi.appendChild(linUs);
			divIdi.appendChild(linMx);
		}

		linksL = document.querySelectorAll(".link-lang");
		controlL(linksL);
	};

	window.onresize = () => {
		manLinks();
	};
	window.addEventListener("scroll", () => {
		if (pageYOffset > 50) {
			logoImg.src = logoDos;
			logoImg.srcset = logoDos;
			logoImg.classList.add("logoH");
			secMenu.classList.add("menuOscuro");
		} else {
			logoImg.src = logImSrc;
			logoImg.srcset = logImSrc;
			logoImg.classList.remove("logoH");
			secMenu.classList.remove("menuOscuro");
		}
	});
	manLinks();

	//const updateSectionLinks = () => {
	if (location.pathname.includes("/es-mx/")) {
		txtLinks[0].href = "/es-mx/nosotros";
		txtLinks[1].href = "/es-mx/proyectos";
		txtLinks[2].href = "/es-mx/espacio";
		txtLinks[3].href = "/es-mx/contacto";
	} else if (location.pathname.includes("/en-us/")) {
		txtLinks[0].href = "/en-us/about-us";
		txtLinks[1].href = "/en-us/projects";
		txtLinks[2].href = "/en-us/space";
		txtLinks[3].href = "/en-us/contact";
	} /* else {
		txtLinks[0].href = "/nosotros";
		txtLinks[1].href = "/proyectos";
		txtLinks[2].href = "/espacio";
		txtLinks[3].href = "/contacto";
	}*/
	//};
	//updateSectionLinks()
});

                  

Calendario php

View Snippet
                    <?php
$todosMeses=array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", 
"Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
$diasSemana = array("Domingo",'Lunes',"Martes","Miercoles","Jueves", "Viernes","Sabado");
$args = array(
  'posts_per_page' => -1, // Esto recuperará todos los elementos. Si deseas limitarlos, puedes cambiarlo.
);
$results = get_posts( $args );
vis($results,'results','grey');
if( ! empty( $results ) ){
  $dates = array();
  $fechas = array();
  $enlaces = array();
  foreach ( $results as $result ){
        $post_date = $result->post_date;
        $fechas[]= strtotime($post_date);
        $dates[] =  $post_date;
        $enlaces[]=$result->guid;
	}
  $unique_dates = array_unique($dates); // Elimina fechas duplicadas
  //$uniq_fechas =array_unique($fechas);
  
   vis($enlaces, 'enlaces', 'red'); 
}
  $ultimaPublicacion = max($fechas);
  $primeraPublicacion = min($fechas);
  $elmesNum = date('n',$ultimaPublicacion );
date_default_timezone_set("Europe/Madrid");
$cMonth = date('n',$ultimaPublicacion );
$cYear = date('Y',$ultimaPublicacion );
?>
<div class="mes-anio-calendario"><?php echo $todosMeses[$cMonth-1].' '.$cYear; ?></div>
<div class="container-semana-letras">
<?php
  for($i=0; $i<7; $i++){
    echo '<div class="dias-semana-calendario">'.$diasSemana[$i].'</div>';
  }
?>
</div>
<div class="container-container">
<?php 
$timestamp = mktime(0,0,0,$cMonth,1,$cYear);
$maxday = date("t",$timestamp);
$thismonth = getdate ($timestamp);
//$thismonth= $primeraPublicacion;
$startday = $thismonth['wday'];
$contas = array();
for ($i=0; $i<($maxday+$startday); $i++) {
if(($i % 7) == 0 ) echo "<div class='container-numeros'>";
if($i < $startday) echo "<div class='container-vacio'></div> ";
else {
   for($a=0; $a < count($fechas); $a++) {
       $diaA = date('j',$fechas[$a] );
       $mesA =date('n',$fechas[$a] ); 
       $coincidencia = false;
     if (($diaA == $i - $startday + 1) && $cMonth==date("n") ){
       $coincidencia = true;
      // $contas[]= $unique_dates[$a];
      break;
     }
   }
  if($coincidencia){ ?>
    <a href="<?php echo $enlaces[$a]; ?>">
  <?php
                   }
  ?>
  <div class='calendario-numero' <?php if ($coincidencia){?> style="background:#8dc63f; color:#fff"<?php }?>> <?php echo ($i - $startday + 1) ?> </div> 
<?php 
if($coincidencia){ echo '</a>';}
}
if(($i % 7) == 6 ) echo "</div>";
}
 //vis($contas,'contas','gray');
?>
</div> 
</div> 

                  

Code for Ovidiu javascript

View Snippet
                    document.addEventListener('DOMContentLoaded', ()=>{
    const ubicacionActual = window.location.href
    const enlacesCabecera = document.querySelectorAll('.header_link')
    const direcciones = ['email','facebook','linkedin','twitter','instagram' ];
    const carRedonda = document.querySelector('.card-imagen-redonda')
    const textoResalta = document.querySelector('.texto-resalta-hover')
    const canva = document.getElementById('seccion-canva-hire')
    const botones = document.querySelectorAll('.boton-hire-me')
    let move = false //Control de posición Canva de Hire Me
    let cantidad = 200 // % Desplazamiento Canva de Hire Me 
    
    enlacesCabecera.forEach((enlaceCab)=>{
       ponActivo = () => enlaceCab.classList.add('activo')
        if(enlaceCab.href == ubicacionActual)  setTimeout(ponActivo, 300);
    })
    direcciones.forEach((direccion)=>{
        let enlazados = document.querySelectorAll('.link-social-link__' + direccion);
        let destino = "facebook.com/Noelia.Amado.Photography/";//If remove this semicolon with minimify option is active console gives error.
        enlazados.forEach((enlazado) =>{ 
            if(direccion === 'email')
                enlazado.href = 'mailto:noelia@noeliaamado.com';
            else{
                 switch(direccion){
                    case'instagram':  destino ="instagram.com/noelia.amado.photography/";
                    break;
                    case'linkedin':   destino ="www.instagram.com/noelia.amado.photography/";
                    break;
                }
            }
                enlazado.href = 'https://'+destino;
        });
     });
     if(ubicacionActual==="https://noeliaamado.com/"){
     textoResalta.addEventListener('mouseover', ()=>{
         carRedonda.classList.add('sobreTexto')
        })
        textoResalta.addEventListener('mouseout', ()=>{carRedonda.classList.remove('sobreTexto')})
    }
    botones.forEach((boton) => {
        boton.addEventListener('click',(e)=>{
            e.preventDefault()
        	move = (move)? false: true
        	if(move){
        	    clase = 'canva-hire-translated-mas';
              canva.style.transform='translateX(0px)'
        	    cantidad = cantidad * -1
        		}else{
        		    clase = 'canva-hire-translated-menos';
                  canva.style.transform='translateX('+cantidad+'%)'
        		} 
        		 
        	})
        })
})
                  

Quitar Enlaces HappyFiles php

View Snippet
                    <?php
function dameNombreseIDs()
{
    $args = [
        "taxonomy" => "happyfiles_category",
        "orderby" => "name",
        "order" => "ASC",
        "hide_empty" => false,
    ];

    $carpetas = get_terms($args);

    foreach ($carpetas as $carpeta) {
        echo "ID: <b>" . $carpeta->term_id . "</b> -- Nombre: <b>" . $carpeta->name . "</b><br>";
    }
}

dameNombreseIDs();
?>