Knowing nothing about Wordpress but understand how to display everything saved within an php array (a minimum of during my situation) - please answer. I'll appreciate!

I have an PHP array that keeps lists of groups. However I have no clue how you can display its contents.

This code:

$category = get_the_category(); 
echo $category;



What I wish to do would be to display first item within the array.

I have also attempted:

  1. echo $category[]->cat_title

  2. echo $category[1]->cat_title

In which the cat_title was "cat_title", "Folio" (my custom publish type title), "type", "types" and "my_folio_cat". Everything results nothing (even not "Array" text).

I am signing up taxonomy like this:

register_taxonomy("my_folio_cat", array("folio"), array("hierarchical" => true, "label" => "Type", "singular_label" => "Type", "rewrite" => true));

try var_dump($category); rather echo $category;

array access is echo $arrayname[]

make var_dump($array) and you will see what's there.


You may also have a look at var_dump() (not meant for reading through) and var_export() (less so).

If you want to print things nicely, you can iterate within the array:

foreach($array as $key => $value) {
    echo 'Key is '.$key.' for value '.$value.'<br />';