Support

Account

Home Forums Add-ons Repeater Field My code doesn't work Reply To: My code doesn't work

  • The code is located on the file “content.php” of the theme Stargazer. I can’t found a standard function. The complete code is presented bellow:

    <article <?php hybrid_attr( 'post' ); ?>>
    
    	<?php if ( is_singular( get_post_type() ) ) : // If viewing a single post. ?>
    
    		<header class="entry-header">
    
    			<h1 <?php hybrid_attr( 'entry-title' ); ?>><?php single_post_title(); ?></h1>
    
    			<div class="entry-byline">
    				<span <?php hybrid_attr( 'entry-author' ); ?>><?php the_author_posts_link(); ?></span>
    				<time <?php hybrid_attr( 'entry-published' ); ?>><?php echo get_the_date(); ?></time>
    				<?php comments_popup_link( number_format_i18n( 0 ), number_format_i18n( 1 ), '%', 'comments-link', '' ); ?>
    				<?php if ( function_exists( 'ev_post_views' ) ) ev_post_views( array( 'text' => '%s' ) ); ?>
    				<?php edit_post_link(); ?>
    			</div><!-- .entry-byline -->
    
    <!-- MOSTRAR CAMPOS PERSONALIZADOS -->
    
    	<!-- Documento principal -->
    
    		<?php
    	$attachment_id = get_field('archivo');
    	$url = wp_get_attachment_url($attachment_id);
    	$title = get_the_title($attachment_id);
    	$path_info = pathinfo(get_attached_file($attachment_id));
    	$filesize = filesize( get_attached_file( $attachment_id ) );
    	$filesize = size_format($filesize, 2);
    
    		if(get_field('archivo')): ?>
    			<div class="titulos_secundarios">Ver documento:</div><br/><br/>
    			<a href="<?php echo $url; ?>" target="_blank" title="Abrir documento en una nueva pestaña" style="display: inline;"><?php echo $title?>.<?php echo $path_info['extension'];?> (<?php echo $filesize; ?>)</a>
    		<?php 
    		endif; 
    ?>
    	<!-- Documentos secundarios -->
    
    		<br/>
    		<div class="titulos_secundarios">Antecedentes</div>
    		<br/>
    
    <?php if(have_rows('otros_archivos')):
    	while (have_rows('otros_archivos')) : the_row();
    	$post_object = get_sub_field('antecedente');
    		echo "<ol>";
    		if($post_object): 
    			$post = $post_object; setup_postdata($post); ?>
    			<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    		<?php wp_reset_postdata();
    		else:
    			echo "<li>No se ha incluido ningún antecedente aún.</li><br/>";
    		endif;
    	echo "</ol>";
    	endwhile;
    endif; ?>
    <!-- FIN MOSTRAR CAMPOS PERSONALIZADOS -->
    
    		</header><!-- .entry-header -->
    
    		<div <?php hybrid_attr( 'entry-content' ); ?>>
    			<?php the_content(); ?>
    			<?php wp_link_pages(); ?>
    		</div><!-- .entry-content -->
    
    		<footer class="entry-footer">
    			<?php hybrid_post_terms( array( 'taxonomy' => 'category', 'text' => __( 'Posted in %s', 'stargazer' ) ) ); ?>
    			<?php hybrid_post_terms( array( 'taxonomy' => 'post_tag', 'text' => __( 'Tagged %s', 'stargazer' ), 'before' => '<br />' ) ); ?>
    		</footer><!-- .entry-footer -->
    
    	<?php else : // If not viewing a single post. ?>
    
    		<?php get_the_image( array( 'size' => 'stargazer-full', 'order' => array( 'featured', 'attachment' ) ) ); ?>
    
    		<header class="entry-header">
    
    			<?php the_title( '<h2 ' . hybrid_get_attr( 'entry-title' ) . '><a href="' . get_permalink() . '" rel="bookmark" itemprop="url">', '</a></h2>' ); ?>
    
    			<div class="entry-byline">
    				<span <?php hybrid_attr( 'entry-author' ); ?>><?php the_author_posts_link(); ?></span>
    				<time <?php hybrid_attr( 'entry-published' ); ?>><?php echo get_the_date(); ?></time>
    				<?php comments_popup_link( number_format_i18n( 0 ), number_format_i18n( 1 ), '%', 'comments-link', '' ); ?>
    				<?php edit_post_link(); ?>
    			</div><!-- .entry-byline -->
    
    		</header><!-- .entry-header -->
    
    		<div <?php hybrid_attr( 'entry-summary' ); ?>>
    			<?php the_excerpt(); ?>
    		</div><!-- .entry-summary -->
    
    	<?php endif; // End single post check. ?>
    
    </article><!-- .entry -->