Search
 
SCRIPT & CODE EXAMPLE
 

PHP

acf looping through post types

<?php 

$posts = get_posts(array(
	'posts_per_page'	=> -1,
	'post_type'			=> 'post'
));

if( $posts ): ?>
	
	<ul>
		
	<?php foreach( $posts as $post ): 
		
		setup_postdata( $post );
		
		?>
		<li>
			<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
		</li>
	
	<?php endforeach; ?>
	
	</ul>
	
	<?php wp_reset_postdata(); ?>

<?php endif; ?>
Comment

PREVIOUS NEXT
Code Example
Php :: smarty php 
Php :: jsondecode php array 
Php :: validate either one field is required in laravel 
Php :: xampp php 5.6 download 64 bit 
Php :: laravel copy row 
Php :: how to create resource controller in laravel 
Php :: php null coalesce 
Php :: laravel passport Route [login] not defined 
Php :: array to comma separated string php 
Php :: laravel array in lang 
Php :: php, Africa timezones 
Php :: keep line breaks in textarea 
Php :: laravel custom exception handler 
Php :: how to setup cron job for laravel queues on shared hosting 
Php :: php localhost 
Php :: sort by number of views descending laravel 
Php :: laravel how can I use the same foreign key twice in a single table 
Php :: composer create project laravel with version 
Php :: ::latest() 
Php :: how to use wherehas in laravel 
Php :: laravel pagination 
Php :: laravel logout after password change 
Php :: how to print something in php 
Php :: convert html to pdf using php.php 
Php :: wp_query custom post type 
Php :: add slashes to string 
Php :: php rce command 
Php :: php ErrorException Undefined variable inside array_map 
Php :: php if in database field exists, if exists update, if not create 
Php :: pregmatch php only numbers and comma and dot 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =