Support

Account

Home Forums General Issues I'm looking to pass data from a field into an existing wp loop Reply To: I'm looking to pass data from a field into an existing wp loop

  • I didn’t paste all the code, sorry. ignore the above and here it is again.
    I have a couple of these “boxes” that are passing data, for different categories, but I would like the user to define what category id # it is. There are 2 places I will need to pass that data. cat=23 and the $news in the get_category_link place.

    <?php $news = the_field('news_box'); ?>
    		<section  class="category-news m-all t-1of2 d-1of2">
    	<h2> <a href="<?php echo get_category_link('$news'); ?>">News</a> </h2>
    			<?php //News Posts
    			$newsPosts = new WP_Query('cat=23&posts_per_page=1');
    			if ($newsPosts->have_posts()) : 
    				while($newsPosts->have_posts()) : $newsPosts->the_post(); ?>
    			<p class="byline entry-meta vcard">
    
                        <?php printf( __( 'Posted', 'bonestheme' ).' %1$s',
                           /* the time the post was published */
                           '<time class="updated entry-time" datetime="' . get_the_time('Y-m-d') . '" itemprop="datePublished">' . get_the_time(get_option('date_format')) . '</time>'
                        ); ?>
    
                      </p>
    		<h3><a href="<?php echo get_post_permalink(); ?>" ><?php the_title(); ?></a></h3>
     		<?php the_excerpt(); ?> 
    		<?php endwhile; else : endif; wp_reset_postdata(); ?>
    		</section>