How do i display singel element in an array
-
I am learner on php programmimg. I loop through an array to enable me display title of one single element in an array and seem not to get it right. Somebody should help me
`<?php
$categories = array(
‘posts_per_page’ => -1,
‘post_type’ => ‘slider’,
‘cat’ => $categories,
‘posts_per_page’ => ‘3’,
‘post_status’ => ‘publish’,
‘suppress_filters’ => true
);
;
$categories = get_the_category();
foreach( $categories as $cat_id ) {
echo $cat_id->name . ‘<br />’;
}?>
The blog I need help with is: (visible only to logged in users)
-
Hi,
The whole idea of WordPress.com is to create sites without the need for coding. You’ll likely find more help at https://wordpress.org/support/forums/.
- The topic ‘How do i display singel element in an array’ is closed to new replies.