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.



UPDATE:
Following partly ialocin and Brad Dalton i came up with this solution, which works like a charm:

function sultenhest($option, $arg){
  $the_array = array();
  foreach( get_option('sultenhest_theme_'.$option) as $key =&gt; $item ){
    $the_array[$key] = $item;
  }
  return $the_array[$arg];
}


and echoing it out like this:

echo sultenhest('social_options', 'twitter') ? '&lt;a href="' . sultenhest('social_options', 'twitter') . '"&gt;Twitter&lt;/a&gt;' : '';



Question: Understanding a \@for loop
Answer: The problem is that TeX finds something following the last \\ which starts a new row (it's neither \noalign nor \crcr that wouldn't).

A solution might be to use a token register: we develop the loop while in the first cell, so there's no problem of \xx not being defined any more after TeX has seen \\ (or &amp;).

\usepackage{amsmath}
\makeatletter
\newcommand{\fbun}[1]{%
  \begin{bmatrix}
  \toks@={\@gobble}%
  \@for\next:=#1\do
    {\toks@=\@xp{\the\@xp\toks@\@xp\\\@xp\text\@xp{\next}}}%
  \the\toks@
  \end{bmatrix}}
\makeatother


I've used \@xp (from amsmath) that's a shorthand for \expandafter; if the \text around the entry wasn't required, then

\toks@=\expandafter{\the\expandafter\toks@\next}


would have sufficed. Initializing \toks@ to \@gobble has the effect that the first \\ is swallowed.

Instead of array I've used bmatrix (change it if you like) and, of course, I deleted \ensuremath as the first step. :)