Title: Custom Theme Options
Last modified: August 19, 2016

---

# Custom Theme Options

 *  [grs](https://wordpress.org/support/users/grs/)
 * (@grs)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/)
 * I created a wordpress theme and added a theme options page using [this tutorial](http://net.tutsplus.com/tutorials/wordpress/how-to-create-a-better-wordpress-options-panel/).
 * I have a small issue and I think it might relate to the wp_enqueue_script wp_enqueue_style
   section of the code.
 * I have my theme set up locally on two computers using xampp, one at home and 
   one at work. The theme options section works beautifully at work but the js and
   css is not called on my set up at home. The theme files are identical (I have
   checked and rewritten repeatedly) but I can not get the options page to work 
   properly at home.
 * Can anyone help me out with this? Is it an enqueue script issue or something 
   else? I am pulling my hair out trying to figure out what is wrong.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1638924)
 * The code in that tutorial is using loads of deprecated functions i’d suggest 
   finding a better and more upto date article and code to work from, i cannot honestly
   recommend following that guide, far too outdated (and there’s silly coding errors
   in there i can’t ignore).
 * I’d suggest using the following instead (better written code and not using old
   functions).
    [http://themeshaper.com/sample-theme-options/](http://themeshaper.com/sample-theme-options/)
 * In regard to the enqueue problem, the first thing to do would be confirm if the
   script or style is output into the source of the page.. (view source).
 * If they’re not appearing in the source of the page, then the problem must be 
   with how you’re enqueuing them, in which case i’d ask if i can see the code you’re
   using to enqueue and where you are placing the enqueues…. Please .. 🙂
 *  Thread Starter [grs](https://wordpress.org/support/users/grs/)
 * (@grs)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639028)
 * Thanks for your fast reply, apolgies I could not match your speed, its been a
   busy week.
    Well after your critique of that tutorial I am inclined to redo my
   theme options page. I am still quite a novice when it comes to php so I’m not
   sure if the link you posted will give me the spoon feeding I need. I will give
   it a go regardless. I would still like to know where I am going wrong with my
   current theme options though. Like I said I am a novice, so I’ve grabbed bits
   from here and there and mashed them together. If you can tell me why this works
   on one computer and not the other I would greatly appreciate it.
 * **[code moderated] Code should be provided by way of a pastebin for anything 
   over 15-20 lines. Have made the necessary paste for you this time.. 😉**
    [http://wordpress.pastebin.com/uhPP5Kb7](http://wordpress.pastebin.com/uhPP5Kb7)
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639031)
 * Hi,
 * As i said before in regard to the enqueue problems, check the source and confirm
   if the styles/scripts are being printed into the source/output of the page correctly
   first.
 * However, i don’t think i’ve seen enqueues hooked onto `init` before, so that 
   could be the problem. There are hooks available specifically for enqueuing scripts,
   namingly `admin_print_scripts` or `admin_head` (assuming you’re targetting the
   administration pages).
 * Hope that helps…
 *  Thread Starter [grs](https://wordpress.org/support/users/grs/)
 * (@grs)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639032)
 * Sorry I forgot to mention that they were being printed. Thanks for your help,
   I will do a bit more research with the hooks you have suggested.
 *  Thread Starter [grs](https://wordpress.org/support/users/grs/)
 * (@grs)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639052)
 * I started again using the themeshaper article, I have hit a snag. I want to change
   the drop down so that it displays all the pages. This is what I have used
 *     ```
       $pages = get_pages();
       foreach ($pages as $pagg) {
       	$select_options[$pagg->post_id]["value"] = $pagg->post_id;
       	$select_options[$pagg->post_id]["label"] = $pagg->post_title;
       }
       ```
   
 * however this only displays the most recently created page.
    How do I get it to
   show all created pages?
 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639059)
 * Your foreach loop is setting the same array item with each iteration instead 
   of creating additional ones, try this instead..
 *     ```
       $pages = get_pages();
       foreach ($pages as $pagg) {
       	$select_options[] = array(
       		'value' => $pagg->post_id,
       		'label' => $pagg->post_title
       	);
       }
       ```
   

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Custom Theme Options’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 6 replies
 * 2 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [15 years, 9 months ago](https://wordpress.org/support/topic/custom-theme-options/#post-1639059)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
