Skip to content

Commit 6d7e800

Browse files
author
Cosmin
authored
Merge pull request #13 from c0sm1n87/master
added styling for the footer widgets, added the documentation button …
2 parents 35c44ea + 856cb4c commit 6d7e800

File tree

8 files changed

+627
-143
lines changed

8 files changed

+627
-143
lines changed

functions.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ function shapely_setup() {
3737
) );
3838

3939
add_theme_support( 'custom-header', apply_filters( 'shapely_custom_header_args', array(
40-
'default-image' => '',
41-
'default-text-color' => '000000',
42-
'width' => 1900,
43-
'height' => 225,
44-
'flex-width' => true
40+
'default-image' => '',
41+
'default-text-color' => '000000',
42+
'width' => 1900,
43+
'height' => 225,
44+
'flex-width' => true
4545
) ) );
4646

4747
/*
@@ -270,8 +270,6 @@ function shapely_scripts() {
270270
wp_enqueue_style( 'owl.carousel', get_template_directory_uri() . '/js/owl-carousel/owl.theme.default.css' );
271271

272272
wp_enqueue_script( 'shapely-scripts', get_template_directory_uri() . '/js/shapely-scripts.js', array( 'jquery' ), '20160115', true );
273-
274-
wp_enqueue_style( 'shapely-scss', get_template_directory_uri() . '/assets/css/style.css' );
275273
}
276274

277275
add_action( 'wp_enqueue_scripts', 'shapely_scripts' );
@@ -286,6 +284,11 @@ function shapely_scripts() {
286284
*/
287285
require get_template_directory() . '/inc/extras.php';
288286

287+
/**
288+
* Add custom section
289+
*/
290+
require get_template_directory() . '/inc/shapely-documentation/class-customize.php';
291+
289292
/**
290293
* Customizer additions.
291294
*/

inc/admin/welcome-screen/css/welcome_customizer.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@
1212
border-radius: 10px;
1313
z-index: 26;
1414
}
15+
Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
jQuery(document).ready(function () {
2-
var shapely_aboutpage = shapelyWelcomeScreenCustomizerObject.aboutpage;
3-
var shapely_nr_actions_required = shapelyWelcomeScreenCustomizerObject.nr_actions_required;
4-
5-
/* Number of required actions */
6-
if ((typeof shapely_aboutpage !== 'undefined') && (typeof shapely_nr_actions_required !== 'undefined') && (shapely_nr_actions_required != '0')) {
7-
jQuery('#accordion-section-themes .accordion-section-title').append('<a href="' + shapely_aboutpage + '"><span class="shapely-actions-count">' + shapely_nr_actions_required + '</span></a>');
8-
}
9-
2+
var shapely_aboutpage = shapelyWelcomeScreenCustomizerObject.aboutpage;
3+
var shapely_nr_actions_required = shapelyWelcomeScreenCustomizerObject.nr_actions_required;
104

5+
/* Number of required actions */
6+
if ( (typeof shapely_aboutpage !== 'undefined') && (typeof shapely_nr_actions_required !== 'undefined') && (shapely_nr_actions_required != '0') ) {
7+
jQuery('#accordion-section-themes .accordion-section-title').append('<a href="' + shapely_aboutpage + '"><span class="shapely-actions-count">' + shapely_nr_actions_required + '</span></a>');
8+
}
119
});
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
3+
/**
4+
* Singleton class for handling the theme's customizer integration.
5+
*
6+
* @since 1.0.0
7+
* @access public
8+
*/
9+
final class Shapely_Documentation_Customize {
10+
/**
11+
* Returns the instance.
12+
*
13+
* @since 1.0.0
14+
* @access public
15+
* @return object
16+
*/
17+
public static function get_instance() {
18+
static $instance = NULL;
19+
if ( is_null( $instance ) ) {
20+
$instance = new self;
21+
$instance->setup_actions();
22+
}
23+
24+
return $instance;
25+
}
26+
27+
/**
28+
* Constructor method.
29+
*
30+
* @since 1.0.0
31+
* @access private
32+
* @return void
33+
*/
34+
private function __construct() {
35+
}
36+
37+
/**
38+
* Sets up initial actions.
39+
*
40+
* @since 1.0.0
41+
* @access private
42+
* @return void
43+
*/
44+
private function setup_actions() {
45+
// Register panels, sections, settings, controls, and partials.
46+
add_action( 'customize_register', array( $this, 'sections' ) );
47+
// Register scripts and styles for the controls.
48+
add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ), 0 );
49+
}
50+
51+
/**
52+
* Sets up the customizer sections.
53+
*
54+
* @since 1.0.0
55+
* @access public
56+
*
57+
* @param object $manager
58+
*
59+
* @return void
60+
*/
61+
public function sections( $manager ) {
62+
// Load custom sections.
63+
require_once( trailingslashit( get_template_directory() ) . 'inc/shapely-documentation/class-shapely-documentation-customizer.php' );
64+
// Register custom section types.
65+
$manager->register_section_type( 'Shapely_Documentation_Customize_Section' );
66+
// Register sections.
67+
$manager->add_section(
68+
new Shapely_Documentation_Customize_Section(
69+
$manager,
70+
'shapely_documentation',
71+
array(
72+
'title' => esc_html__( 'Shapely', 'shapely' ),
73+
'pro_text' => esc_html__( 'Documentation', 'shapely' ),
74+
'pro_url' => 'https://colorlib.com/wp/support/shapely/',
75+
'priority' => 0,
76+
)
77+
)
78+
);
79+
}
80+
81+
/**
82+
* Loads theme customizer CSS.
83+
*
84+
* @since 1.0.0
85+
* @access public
86+
* @return void
87+
*/
88+
public function enqueue_control_scripts() {
89+
wp_enqueue_script( 'shapely-documentation-customize-controls', trailingslashit( get_template_directory_uri() ) . 'inc/shapely-documentation/customize-controls.js', array( 'customize-controls' ) );
90+
wp_enqueue_style( 'shapely-documentation-customize-controls', trailingslashit( get_template_directory_uri() ) . 'inc/shapely-documentation/customize-controls.css' );
91+
}
92+
}
93+
94+
Shapely_Documentation_Customize::get_instance();
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
/**
4+
* Pro customizer section.
5+
*
6+
* @since 1.0.0
7+
* @access public
8+
*/
9+
class Shapely_Documentation_Customize_Section extends WP_Customize_Section {
10+
/**
11+
* The type of customize section being rendered.
12+
*
13+
* @since 1.0.0
14+
* @access public
15+
* @var string
16+
*/
17+
public $type = 'shapely-documentation';
18+
/**
19+
* Custom button text to output.
20+
*
21+
* @since 1.0.0
22+
* @access public
23+
* @var string
24+
*/
25+
public $pro_text = 'Shapely';
26+
/**
27+
* Custom pro button URL.
28+
*
29+
* @since 1.0.0
30+
* @access public
31+
* @var string
32+
*/
33+
public $pro_url = 'https://colorlib.com';
34+
35+
/**
36+
* Add custom parameters to pass to the JS via JSON.
37+
*
38+
* @since 1.0.0
39+
* @access public
40+
* @return void
41+
*/
42+
public function json() {
43+
$json = parent::json();
44+
$json['pro_text'] = $this->pro_text;
45+
$json['pro_url'] = esc_url( $this->pro_url );
46+
47+
return $json;
48+
}
49+
50+
/**
51+
* Outputs the Underscore.js template.
52+
*
53+
* @since 1.0.0
54+
* @access public
55+
* @return void
56+
*/
57+
protected function render_template() { ?>
58+
<li id="accordion-section-{{ data.id }}"
59+
class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
60+
61+
<h3 class="accordion-section-title">
62+
{{ data.title }}
63+
64+
<# if ( data.pro_text && data.pro_url ) { #>
65+
<a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{
66+
data.pro_text }}</a>
67+
<# } #>
68+
</h3>
69+
</li>
70+
<?php }
71+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#customize-controls .control-section-shapely-documentation .accordion-section-title:hover,
2+
#customize-controls .control-section-shapely-documentation .accordion-section-title:focus {
3+
background-color: #fff;
4+
}
5+
6+
.control-section-shapely-documentation .accordion-section-title .button {
7+
margin-top: -4px;
8+
font-weight: 400;
9+
margin-left: 8px;
10+
}
11+
12+
.rtl .control-section-shapely-documentation .accordion-section-title .button {
13+
margin-left: 0;
14+
margin-right: 8px;
15+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function (api) {
2+
api.sectionConstructor[ 'shapely-documentation' ] = api.Section.extend({
3+
4+
// No events for this type of section.
5+
attachEvents: function () {
6+
},
7+
8+
// Always make the section active.
9+
isContextuallyActive: function () {
10+
return true;
11+
}
12+
});
13+
14+
})(wp.customize);

0 commit comments

Comments
 (0)