vendredi 27 février 2015

get_option function


I'm currently trying to make my own theme, but i'm not quite sure how the get_option() function works, because how come this..



echo get_option('show_header', 'sultenhest_theme_display_options');
echo get_option('sultenhest_theme_display_options')['show_header'];


..both returns 1 (but Dreamweaver doesnt like the second option). While



echo get_option('twitter', 'sultenhest_theme_social_options');


..simply returns 'sultenhest_theme_social_options', which is incorrect.


An option would be to define the array as such



$social_options = get_option( 'sultenhest_theme_social_options' );


and call it like this



echo $social_options['twitter'];


It returns the correct string, but it only works in the header.php (if the array is defined there) file and not in, e.g. footer.php.





Aucun commentaire:

Enregistrer un commentaire