Problema con breadcrumbs en functions.php

  • Autor Autor nicorto
  • Fecha de inicio Fecha de inicio
N

nicorto

Lambda
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
 
Me acabo de conectar, me alegro de que lo hayas solucionado 🙂
 
Atrás
Arriba