This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Adding admin option to child theme

  • Creator
    Topic
  • #743
    phirephoenix
    Member

    Hi there,

    I’m trying to add a few extra options to the admin panel where the user can enter in some additional info and have it show up in the layout. I figured out how to do that by modifying the includes/options.php file, but I’d like to keep my modifications in the child theme. How do I add an option without modifying the original Alyeska theme files?

    Things I’ve tried:
    – copying the includes/options.php file into the child theme folder
    – copying the code I used into the functions.php file in the child theme folder (this removes the “Style” admin tab, and also replaces an existing option with my new one, rather than adding it to the end of the section)

    Here’s the code in question that works in the alyeska/includes/options.php. (When I tried adding it to the child functions.php file I wrapped function alyeska_options() {} around it, which I’m guessing created the conflict that killed the “Styles” tab.)

    // Add header phone number option to Layout > Header
    		$header_phone = array( 
    			'name' 		=> __( 'Header Phone', TB_GETTEXT_DOMAIN ),
    			'desc'		=> __( 'Enter the phone number you would like to call out on the front page', TB_GETTEXT_DOMAIN ),
    			'id'		=> 'header_phone',
    			'std'		=> '',
    			'type' 		=> 'text'
    		);
    		themeblvd_add_option( 'layout', 'header', 'header_phone', $header_phone );
    		themeblvd_remove_option( 'layout', 'header', 'social_media', $social_media );

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #744
    Jason Bobich
    Keymaster

    Hello,

    You’re almost there, but just forget about wrapping it in alyeska_options function. Just place the Theme Options API functions directly in your Child theme’s functions.php after the framework is included at the top. You don’t need to wrap it in anything if you don’t want, but wrapping it in alyeska_options will override the theme’s version. You can’t have the same function declared twice in PHP.

    #745
    phirephoenix
    Member

    Hey, would you look at that. That was far easier than what I’d been trying to do. Thanks!

    Bonus, totally optional question: is there any way of specifying where the option falls in the header section? Not a huge deal if not, but it’d be great if I could get it to sit at the end.

    #749
    Jason Bobich
    Keymaster

    No, you can’t specify for an individual option, however if you wanted to add a new section within the Layout tab, you could use the last parameter to place it at the top above the other sections.

    http://dev.themeblvd.com/tutorial/addremove-options-section/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.