• Resuelto smjre

    (@smjre)


    Hola en mi pagina local me sale este error quisiera solucionarlo

    Notice: Undefined index: id in C:\xampp\htdocs\vargasesnoticia\wp-content\themes\sahifa\framework\blocks\block-categories.php on line 4

    este es son los codigo en php

    <?php
    	global $count2, $block, $page_builder_id ;
    	
    	$Cat_id = $block['id'];
    
    	$args = array(
    		'cat'					 => $Cat_id,
    		'no_found_rows'          => true,
    		'ignore_sticky_posts'	 => true
    	);
    
    	if( !empty($block['number']) )
    		$args['posts_per_page'] = $block['number'];
    		
    	if( !empty($block['order']) && $block['order'] == 'rand' )
    		$args['orderby'] = 'rand';
    	
    	if( !empty($block['offset']) )	
    		$args['offset'] =  $block['offset'];
    
    	$cat_query = new WP_Query( $args ); 
    	$cat_title = get_the_category_by_ID($Cat_id);
    	$count = 0;
    	$home_layout = $block['style'];
    
    	
    ?>
    	<?php if( $home_layout == '2c'):  //************** 2C ****************************************************** ?>
    		<?php $count2++; ?>
    		<section class="cat-box column2 tie-cat-<?php echo $Cat_id ?> <?php if($count2 == 2) { echo 'last-column'; $count2=0; } ?>">
    			<div class="cat-box-title">
    				<h2><a href="<?php echo get_category_link( $Cat_id ); ?>"><?php echo is_string($cat_title) ? $cat_title : '' ; ?></a></h2>
    
    				<div class="stripe-line"></div>
    			</div>
    			<div class="cat-box-content">
    			
    				<?php if($cat_query->have_posts()): ?>
    				<ul>
    				<?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
    				<?php if($count == 1) : ?>
    					<li <?php tie_post_class('first-news'); ?>>
    						<div class="inner-content">
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_first'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark">
    									<?php the_post_thumbnail( 'tie-medium' ); ?>
    									<span class="fa overlay-icon"></span>
    								</a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>
    					
    						<h2 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    						
    							<?php get_template_part( 'framework/parts/meta-blocks' ); ?>
    					
    							<div class="entry">
    								<p><?php tie_excerpt_home() ?></p>
    								<a class="more-link" href="<?php the_permalink() ?>"><?php _eti( 'Read More &raquo;' ) ?></a>
    							</div>
    						</div>
    					</li><!-- .first-news -->
    					<?php else: ?>
    					<li <?php tie_post_class( 'other-news' ); ?>>
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_small'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'tie-small' ); ?><span class="fa overlay-icon"></span></a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>			
    						<h3 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    						<?php get_template_part( 'framework/parts/meta-blocks' ); ?>					
    					</li>
    					<?php endif; ?>
    				<?php endwhile;?>
    				</ul>
    
    				<?php endif; ?>
    			</div><!-- .cat-box-content /-->
    		</section> <!-- Two Columns -->
    		
    		
    	<?php elseif( $home_layout == '1c' ):  //************** 1C ******************************************************  ?>
    		<section class="cat-box wide-box tie-cat-<?php echo $Cat_id ?>">
    			<div class="cat-box-title">
    				<h2><a href="<?php echo get_category_link( $Cat_id ); ?>"><?php echo is_string($cat_title) ? $cat_title : '' ; ?></a></h2>
    				<div class="stripe-line"></div>
    			</div>
    			<div class="cat-box-content">
    			
    				<?php if($cat_query->have_posts()): ?>
    				<ul>
    				<?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
    				<?php if($count == 1) : ?>
    					<li <?php tie_post_class( 'first-news' ); ?>>
    						<div class="inner-content">
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_first'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark">
    									<?php the_post_thumbnail( 'tie-medium' ); ?>
    									<span class="fa overlay-icon"></span>
    								</a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>
    					
    						<h2 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    						
    							<?php get_template_part( 'framework/parts/meta-blocks' ); ?>					
    							<div class="entry">
    								<p><?php tie_excerpt_home() ?></p>
    								<a class="more-link" href="<?php the_permalink() ?>"><?php _eti( 'Read More &raquo;' ) ?></a>
    							</div>
    						</div>
    					</li><!-- .first-news -->
    					<?php else: ?>
    					<li <?php tie_post_class( 'other-news' ); ?>>
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_small'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'tie-small' ); ?><span class="fa overlay-icon"></span></a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>			
    						<h3 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    						<?php get_template_part( 'framework/parts/meta-blocks' ); ?>					
    					</li>
    					<?php endif; ?>
    				<?php endwhile;?>
    				</ul>
    				<div class="clear"></div>
    
    					<?php endif; ?>
    			</div><!-- .cat-box-content /-->
    		</section><!-- Wide Box -->
    
    	<?php else :   //************** list **********************************************************************************  ?>
    		
    		<section class="cat-box list-box tie-cat-<?php echo $Cat_id ?>">
    			<div class="cat-box-title">
    				<h2><a href="<?php echo get_category_link( $Cat_id ); ?>"><?php echo $cat_title ; ?></a></h2>
    				<div class="stripe-line"></div>
    			</div>
    			<div class="cat-box-content">
    			
    				<?php if($cat_query->have_posts()): ?>
    				<ul>
    				<?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
    				<?php if($count == 1) : ?>
    					<li <?php tie_post_class( 'first-news' ); ?>>
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_first'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark">
    									<?php the_post_thumbnail( 'tie-medium' ); ?>
    									<span class="fa overlay-icon"></span>
    								</a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>
    					
    						<h2 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
    						
    							<?php get_template_part( 'framework/parts/meta-blocks' ); ?>					
    							<div class="entry">
    								<p><?php tie_excerpt_home() ?></p>
    								<a class="more-link" href="<?php the_permalink() ?>"><?php _eti( 'Read More &raquo;' ) ?></a>
    							</div>
    						</li><!-- .first-news -->
    					<?php else: ?>
    					<li <?php tie_post_class( 'other-news' ); ?>>
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() && empty( $block['thumb_small'] ) ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_post_thumbnail( 'tie-small' ); ?><span class="fa overlay-icon"></span></a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>			
    						<h3 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    						<?php get_template_part( 'framework/parts/meta-blocks' ); ?>
    					</li>
    					<?php endif; ?>
    				<?php endwhile;?>
    				</ul>
    				<div class="clear"></div>
    
    					<?php endif; ?>
    			</div><!-- .cat-box-content /-->
    		</section><!-- List Box -->
    
    	<?php endif; ?>
    	<?php wp_reset_query(); ?>
    
    <?php
    	global $block, $page_builder_id, $get_meta;
    	
        wp_enqueue_script( 'tie-cycle' );
    
    	$cat_id = $block['id'];
    	$title = '';
    	if( !empty($block['title']) )
    		$title = $block['title'];
    
    	$args = array(
    		'cat'					 => $cat_id,
    		'no_found_rows'          => true,
    		'ignore_sticky_posts'	 => true
    	);
    		
    	if( !empty($block['number']) )	
    		$args[ 'posts_per_page' ] = $block['number'];
    
    	if( !empty($block['offset']) )	
    		$args[ 'offset' ] =  $block['offset'];
    
    		
    	$cat_query = new WP_Query( $args ); 
    ?>
    		<section class="cat-box scroll-box tie-cat-<?php echo $cat_id ?>">
    		
    		<?php if ( !empty( $title ) ) : ?>
    			<div class="cat-box-title">
    				<h2><a href="<?php echo get_category_link( $cat_id ); ?>"><?php if( function_exists('icl_t') ) echo icl_t( THEME_NAME , 'wpml-'.$page_builder_id.'-'.$block['boxid'] , $title); else echo $title ; ?></a></h2>
    				<div class="stripe-line"></div>
    			</div>
    		<?php endif; ?>
    		
    			<div class="cat-box-content">
    				<?php if($cat_query->have_posts()): ?>
    				<div id="slideshow<?php echo $cat_id ?>" class="group_items-box">
    				<?php while ( $cat_query->have_posts() ) : $cat_query->the_post()?>
    					<div <?php tie_post_class('scroll-item'); ?>>
    						<?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>			
    							<div class="post-thumbnail">
    								<a href="<?php the_permalink(); ?>" rel="bookmark">
    									<?php the_post_thumbnail( 'tie-medium' ); ?>
    									<span class="fa overlay-icon"></span>
    								</a>
    							</div><!-- post-thumbnail /-->
    						<?php endif; ?>			
    						<h3 class="post-box-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h3>
    						<p class="post-meta">
    							<?php if( !empty( $get_meta[ 'box_meta_score'][0] )) tie_get_score(); ?>
    							<?php if( !empty( $get_meta[ 'box_meta_date' ][0] )) tie_get_time() ; ?>
    						</p>
    					</div>
    				<?php endwhile;?>
    				<div class="clear"></div>
    				</div>
    				<div id="nav<?php echo $cat_id ?>" class="scroll-nav"></div>
    					<?php endif; ?>
    			</div><!-- .cat-box-content /-->
    		</section>
    		<div class="clear"></div>
    <script type="text/javascript">
    	jQuery(document).ready(function() {
    		var vids = jQuery("#slideshow<?php echo $cat_id ?> .scroll-item");
    		for(var i = 0; i < vids.length; i+=3) {
    		  vids.slice(i, i+3).wrapAll('<div class="group_items"></div>');
    		}
    		jQuery(function() {
    			jQuery('#slideshow<?php echo $cat_id ?>').cycle({
    				fx:     'scrollHorz',
    				timeout: 3000,
    				pager:  '#nav<?php echo $cat_id ?>',
    				slideExpr: '.group_items',
    				speed: 300,
    				slideResize: false,
    				pause: true
    			});
    		});
      });
    </script>
    <?php wp_reset_query(); ?>
Viendo 1 respuesta (de un total de 1)
Viendo 1 respuesta (de un total de 1)
  • El debate ‘problemas con mi block-categories’ está cerrado a nuevas respuestas.