php - Making use of var_dump on WordPress functions -


i trying deep wordpress development, wondering when var_dump($post->post_id), gives list of objects that, function has. reason said objects, don't know are. while gives comprehensive list of properties can access wordpress codex page state. question how can access other function , properties like:

`get_the_category();`, might naive list of properties  $category = get_the_category(); foreach ($category $cat) { echo $cat; } 

how can access properties of wordpress function, example $category->id() or other properties, other example might include

      <?php          if ( have_posts() ) {           while ( have_posts() ) {             the_post();          ?>         <?php                $test = get_cat_id($post->id);                var_dump($test)         ?>          <?php }        }        ?> 

but in example, int(0), how can different properties on post, category, slug, taxonomies etc.

i think you're trying information api programmatically. problem php not suited that, because there not static types. in case, wordpress makes use of on-the-fly generated objects , associative arrays. if template function return objects of type, properties of type , have answer.

however, not case, can call function in question once , take @ result. in case example:

$category = get_the_category(); var_dump($category); 

of course, take @ code figure out how result value like. quite cumbersome though, because there myriad of other functions being called assemble result.

note: not work functions. there output result rather returning it. don't need investigate these, however, because result single string. (you can recognize these functions prefix the_, not get_the_ in example.)

if totally missed point, let me know , i'll try again. ;-)


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -