Problema com breadcrumbs no functions.php

  • Autor Autor nicorto
  • Data de início Data de início
Tradução em andamento: em alguns minutos este tópico estará em português. Por enquanto, o conteúdo está no original em espanhol. Ver original
N

nicorto

Lambda
Verificación en dos pasos activada
Hola, el amigo ecoal95 me pasó esta función para crear los breadcrumbs en mis sitios, el problema que tengo es que al insertarlo dentro del functions.php me salta error o no me permite guardar ediciones dentro de panel del WP. Le envié mp pero parece que todavía no está online y necesito arreglarlo ahora.
Este es el código

PHP:
function ec_breadcrumbs($use = 'microdata') {
	$separator = ' › ';
	
	?><div class="breadcrumbs"><?php

	if( $use === 'rdfa' ):
		?><span xmlns:v="http://rdf.data-vocabulary.org/#">
	<span typeof="v:Breadcrumb">
		<a href="<?php bloginfo('url') ?>" title="Ir al inicio" rel="v:url" property="v:title">Home</a>
	</span><?php
		echo $separator 
	?><span typeof="v:Breadcrumb"><?php 
		$cat = get_the_category();
		if( $cat ):
			$cat = $cat[0];
		else:
			$cat = (object) array('term_id' => 1,
			'name' => 'Sin Categoría' );
		endif;
			?><a href="<?php echo get_category_link( $cat->term_id ) ?>" title="Ver todos los posts en <?php echo $cat->name ?>" rel="v:url" property="v:title"><?php echo $cat->name ?></a></span><?php
		echo $separator;
	?><span typeof="v:Breadcrumb"><span class="breadcrumb_last" property="v:title"><?php the_title(); ?></span></span>
	</span>
	</span><?php	
	elseif ( ! $use):
		?><a title="Ir al inicio" href="<?php bloginfo('url') ?>" class="site-home" rel="home" >Home</a><?php 
		$cat = get_the_category();
		if( $cat ):
			$cat = $cat[0];
		else:
			$cat = (object) array('term_id' => 1,
			'name' => 'Sin Categoría' );
		endif;

		echo $separator;

		?><a class="category" href="<?php echo get_category_link( $cat->term_id ) ?>" title="Ver todos los posts en <?php echo $cat->name ?>"><?php echo $cat->name ?></a><?php

			echo $separator;

			echo get_the_title();
	else:
		?><span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
			<a href="<?php bloginfo('url') ?>" title="Ir al inicio" rel="home" itemprop="url"><span itemprop="title">Inicio</span></a>
				<?php echo $separator; ?>
				<span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><?php 
					$cat = get_the_category();
					if( $cat ):
						$cat = $cat[0];
					else:
						$cat = (object) array('term_id' => 1,
						'name' => 'Sin Categoría' );
					endif;
				?><a href="<?php echo get_category_link( $cat->term_id ) ?>" title="Ver todos los posts en <?php echo $cat->name ?>" rel="tag" itemprop="url"><span itemprop="title"><?php echo $cat->name ?></span></a><?php
					echo $separator;
				?><span itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title"><?php the_title() ?></span></span>
				</span>
			</span>
<?php
	endif;
	?></div><?php
	return true;
}

saludos gracias

- - - Actualizado - - -

solucionado
 
Foi útil? Participe da conversa

Com sua conta grátis você pode responder, mandar mensagem privada ao autor e comprar com Saldo retido: o pagamento é liberado quando você recebe o combinado.

Leva 30 segundos · você volta a este tópico ao terminar
Me acabo de conectar, me alegro de que lo hayas solucionado 🙂
 
Voltar
Topo