Unyson icon indicating copy to clipboard operation
Unyson copied to clipboard

Custom Backend Theme

Open PalThemes opened this issue 9 years ago • 13 comments

Hello, thanks for this awesome framework. I just wanna ask, there's a way to make a custom backend panel style? like adding brand logo image (instead theme name and author name) on top left theme settings panel.

This is what i mean. Default theme settings panel heading is now appeared like this: {Theme_name} by {Author name}

I wanted to change it like this: {author_logo_image} {theme_name} {theme_version}

And also, i'd like to add some icon for my option tabs list and custom style for options panel.

Thank you in advanced.

PalThemes avatar Feb 22 '17 04:02 PalThemes

I wanted to change it like this: {author_logo_image} {theme_name} {theme_version}

It's not possible. Please provide a screenshot with how the final result should look and I will try to figure out a solution.

And also, i'd like to add some icon for my option tabs list and custom style for options panel.

Icons for tabs are not supported too. You can include your custom styles as a css from theme to overwrite default styles. Do the enqueue on this action

ghost avatar Feb 22 '17 06:02 ghost

Thanks for your response. I edited admin panel from "inspect element", I wanna change my admin panel looks like this (actually this is not the final result) custom-admin-panel

I need a changes on html template so it's not possible to edit admin panel just by replacing css styles.

Thank you.

PalThemes avatar Feb 22 '17 07:02 PalThemes

Thanks for the screenshot. Someday we will implement this feature (I can't give any ETA)

ghost avatar Feb 22 '17 08:02 ghost

so it's not possible to edit admin panel just by replacing css styles

it is completely doable , we did it 2 years ago and is somewhat what you have in screenshot, you just need to CSS it properly. Cant share at this moment but will once it is released.

danyj avatar Feb 22 '17 10:02 danyj

@moldcraft thanks, i will wait that :)

@danyj wow, that's nice. And you add an icon for tabs too? anyway, how can you displaying theme version on admin panel header? maybe you can give me your tricks.

PalThemes avatar Feb 22 '17 10:02 PalThemes

And you add an icon for tabs too?

yes everything , just add custom class to tabs li

'li-attr' => array('class' => 'my-class-for-icon'),

how can you displaying theme version on admin panel header

	if($('.fw-settings-form-header h2').length){
		$('.fw-settings-form-header h2').append('<br /><small>v '+thzadminurls.themeversion+'</small>');
	}

danyj avatar Feb 22 '17 10:02 danyj

@danyj ah yeah, i got it! why i didn't try this way before :D

thank you so much, i will implementing this on my theme :)

PalThemes avatar Feb 22 '17 11:02 PalThemes

Finally, done!

assez-admin-panel

Thank you @danyj :)

PalThemes avatar Feb 22 '17 14:02 PalThemes

told you :)

danyj avatar Feb 22 '17 14:02 danyj

@PalThemes looks nice. share this if possible with us.

cyberks avatar Feb 23 '17 18:02 cyberks

@cyberks sure :)

Here's my current scripts.

hooks.php ({theme}/inc/hooks.php)

if ( defined( 'FW' ) ):
	add_action('fw_admin_enqueue_scripts:settings', function(){
		wp_enqueue_style(
			'palthemes-admin-panel',
			get_template_directory_uri() . '/lib/css/admin-panel.css',
			array(),
			fw()->theme->manifest->get_version()
		);
		
		wp_register_script(
			'palthemes-admin-panel-script',
			get_template_directory_uri() . '/lib/js/admin-panel.js',
			array( 'fw' ),
			fw()->theme->manifest->get_version(),
			true
		);
		
		$current_theme = wp_get_theme();
		$data_array = array(
			'name'		=> $current_theme->get( 'Name' ),
			'version'	=> $current_theme->get( 'Version' )
		);
		wp_localize_script( 'palthemes-admin-panel-script', 'theme_info', $data_array );
		wp_enqueue_script( 'palthemes-admin-panel-script' );
	});
endif;
(function($) {
    "use strict";
	$(document).ready(function(){
		var $heading = $( ".fw-settings-form-header h2" );
		$heading.html( theme_info.name )
			 .prepend( '<div class="logo"></div>' )
			 .append( '<span>' + theme_info.version + '</span>' );
		
		fwEvents.on('fw:options:init', function(){
			var $side_tab = $('.fw-options-tabs-list').slice(0, 1);
			$('.fw-options-tabs-wrapper > .fw-options-tabs-contents, #wpbody-content .metabox-holder.fw-options-tabs-contents').css('min-height', $side_tab.innerHeight());
		});
	});
})(jQuery);

admin-panel.css ({theme}/lib/css/admin-panel.css)

.fw-backend-option .fw-backend-option-input input[type="text"],
.fw-backend-option .fw-backend-option-input input[type="password"],
.fw-backend-option .fw-backend-option-input select,
.fw-backend-option .fw-backend-option-input textarea,
.fw-selectize.selectize-control > .selectize-input,
.fw-selectize.selectize-control > .selectize-input.has-items,
.fw-selectize.selectize-control > .selectize-input.input-active {
    box-shadow: none;
    line-height: 30px;
    padding: 0 5px;
	background: #fafafa;
}
.fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
	z-index: 999;
}
.fw-backend-side-tabs .fw-settings-form-header {
	background: #fdfdfd;
	border-bottom: 1px solid rgba(0,0,0,.1);
}
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-save,
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-save:hover {
	background: #00a0d2;
	color: #FFF;
    height: 31px;
    line-height: 29px;
}
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-reset {
	color: #333;
}
.fw-backend-side-tabs .fw-settings-form-header .form-header-buttons .submit-button-separator {
    background-color: rgba(0,0,0,0.5);
}
.fw-backend-side-tabs .fw-settings-form-header h2 {
    position: absolute;
	padding: 40px 20px;
    width: 210px;
    top: 0;
    left: 0;
    height: 150px;
    background: url(../img/admin-heading.png) #0073aa;
	text-align: center;
	font-size: 17px;
	line-height: 18px;
	font-weight: 600;
}
.fw-backend-side-tabs .fw-settings-form-header h2 .logo {
	display: block;
	width: 100%;
	height: 110px;
	background: url(../img/palthemes-logo.png);
	background-position: center center;
	background-size: contain;
	background-repeat: no-repeat;
	margin-bottom: 20px;
}
.fw-backend-side-tabs .fw-settings-form-header h2 span {
	font-weight: 200;
	display: inline-block;
	margin-left: 5px;
	opacity: .8;
}

.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list {
	padding-top: 200px;
	width: 250px;
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents {
    margin-left: 250px !important;
}
.fw-backend-side-tabs .fw-options-tabs-wrapper + .form-footer-buttons {
    margin: -71px 0 0 250px;
}
.fw-backend-side-tabs .fw-options-tabs-first-level {
	background: #23282d;
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li a.nav-tab {
	background: #23282d;
	color: #FFF;
	line-height: 40px;
	height: 40px;
	padding: 0 25px;
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li a.nav-tab:hover {
	background: #191e23;
	color: #00b9eb;
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li.ui-state-active a.nav-tab,
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li.ui-state-active a.nav-tab:hover {
	position: relative;
	background-color: #0073aa;
    color: #fff;
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li.ui-state-active a.nav-tab:after {
	content: "";
	position: absolute;
	right: 0;
	top: 10px;
	bottom: 10px;
	border-width: 10px 10px 10px 0;
	border-color: transparent #FFF transparent transparent;
	border-style: solid;
}

.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-list ul li {
	border: 0;
}
.ui-corner-top.ui-tabs-active a {
	font-weight: normal;
}
.fw-options-tabs-first-level .ui-corner-top a:before {
	content: "\f085";
	font-family: FontAwesome;
	margin-right: 12px;
	font-weight: normal;
	font-style: normal;
	text-rendering: auto;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}
.ui-corner-top.general a:before {
	content: "\f108";
}
.ui-corner-top.socials a:before {
	content: "\f1e0";
}
.ui-corner-top.header a:before {
	content: "\f151";
}
.ui-corner-top.footer a:before {
	content: "\f150";
}
.ui-corner-top.template a:before {
	content: "\f0db";
}
.ui-corner-top.post a:before {
	content: "\f1ea";
}
.ui-corner-top.color a:before {
	content: "\f1fc";
}
.ui-corner-top.shop a:before {
	content: "\f07a";
}
.ui-corner-top.typography a:before {
	content: "\f031";
}
.ui-corner-top.advanced a:before {
	content: "\f12e";
}
.fw-backend-side-tabs .fw-options-tabs-first-level > .fw-options-tabs-contents > .fw-inner > .fw-options-tab > .fw-options-tabs-wrapper > .fw-options-tabs-list ul li a.nav-tab:before {
	content: none;
}

PalThemes avatar Feb 25 '17 05:02 PalThemes

and don't forget to add class to your li menu.

**example:**

$options = array(
	'general' => array(
		'title'   => esc_html__( 'General', 'palthemes' ),
		'type'    => 'tab',
		'li-attr'	=> array(
			'class'	=> 'general'
		),
		'options' => array(
			'general' => array(
				'title'   => esc_html__( 'General', 'palthemes' ),
				'type'    => 'tab',
				'options' => array(
					fw()->theme->get_options( 'general' ),
				),
			),
			'branding' => array(
				'title'   => esc_html__( 'Branding', 'palthemes' ),
				'type'    => 'tab',
				'options' => array(
					fw()->theme->get_options( 'branding' ),
				),
			),
		)
	)
);

PalThemes avatar Feb 25 '17 05:02 PalThemes

I tried but it didn't work for me.

kaxigt avatar Mar 18 '17 17:03 kaxigt