Viewing 4 reply threads
  • Author
    Posts
    • #1957
      civilz
      Member

      hi
      i read this tutorial :
      http://piklist.com/user-guide/tutorials/display-taxonomies-as-a-dropdown-or-radio-buttons/

      and display taxonomies as a dropdown in setting page.
      but how to use result in theme ?
      i want use result (ID of category) to theme .
      i want just return ID [number].

      thanks.

    • #1959
      sanderschat
      Member

      Hi Civilz,

      try this:

      in your front-end php:

      $theme_settings = get_option('**YOUR SETTING NAME HERE***');

      you find your setting-name in the top of your setting-page, where you defined your fields.

      the returning value is an array of ALL your setting-fields.
      So pick the one you want for use in your front-end

      do a print_r($theme_settings); on your front-end if you are not sure what your variable looks like

      hope this helps

    • #1960
      civilz
      Member

      i want when user select one “category” in setting page , then return id of that category user selected.
      and use in theme.
      plz one simple example for me.
      1-how to load category in theme setting page.
      2- how to use category id in theme.
      thanks

    • #1961
      sanderschat
      Member

      on the theme-setting page:

      /*
         Title: YOUR TITLE
         Setting: your_setting_name
       */
      
      piklist('field', array('type'        => 'select',
                             'field'       => 'xx_category',
                             'label'       => 'Select your category',
                             'description' => '',
                             'choices'     => array(0 => "Select...") + piklist(get_categories(array('hide_empty' => FALSE, 'taxonomy'   => 'category',)), array('term_id','name'))));

      on your theme page:

      $theme_settings = get_option('your_setting_name');
      echo $theme_settings['xx_category'];

      i did not test this, but should give you a good direction

    • #1963
      civilz
      Member

      thanks @sanderschat

Viewing 4 reply threads
  • The topic ‘how to diplasy of taxonomy and put the theme?’ is closed to new replies.