Skip to content

Commit 1d3a56d

Browse files
jyotibansal461actuallyakash
authored andcommitted
schema issue fixed
1 parent d731a62 commit 1d3a56d

3 files changed

Lines changed: 50 additions & 142 deletions

File tree

assets/css/howto.css

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,19 @@
1414
display: flex;
1515
}
1616

17+
.mt-how-to-step.mt-has-img.mt-step-img-bottom {
18+
flex-direction: column;
19+
}
20+
.mt-how-to-step.mt-has-img.mt-step-img-top {
21+
flex-direction: column-reverse;
22+
}
23+
.mt-how-to-step.mt-has-img.mt-step-img-left {
24+
flex-direction: row-reverse;
25+
}
26+
.mt-how-to-step.mt-has-img.mt-step-img-right {
27+
flex-direction: row;
28+
}
29+
1730
.mt-how-to-supply {
1831
margin-bottom: 10px;
1932
}

assets/css/howto.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

widgets/howto.php

Lines changed: 36 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ protected function register_controls() {
6767
'label' => __( 'Enable How To Schema', 'mighty' ),
6868
'type' => Controls_Manager::SWITCHER,
6969
'default' => 'yes',
70-
'description' => 'Enble it if you want to add How to page schema on your page. To use schema markup, your page must have only single instance of HowTo widget. Use JSON method',
70+
'description' => 'Enble it if you want to add How to page schema on your page. To use schema markup, your page must have only single instance of HowTo widget.',
7171
]
7272
);
7373

@@ -586,7 +586,7 @@ protected function register_controls() {
586586
'steps_title', [
587587
'label' => esc_html__( 'Title', 'mighty' ),
588588
'type' => Controls_Manager::TEXT,
589-
'default' => 'Necessary Steps',
589+
'default' => 'Required Steps',
590590
'dynamic' => [ 'active' => true ],
591591
]
592592
);
@@ -618,6 +618,7 @@ protected function register_controls() {
618618
'label' => __( 'Description', 'mighty' ),
619619
'type' => Controls_Manager::TEXTAREA,
620620
'dynamic' => [ 'active' => true ],
621+
'default' => 'Click edit button to change this text. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.',
621622
]
622623
);
623624

@@ -633,104 +634,6 @@ protected function register_controls() {
633634
]
634635
);
635636

636-
$repeater->add_control(
637-
'image_position',
638-
[
639-
'label' => __( 'Image Positon', 'mighty' ),
640-
'type' => Controls_Manager::SELECT,
641-
'default' => __('default'),
642-
'options' => [
643-
'default' => __('Default', 'mighty'),
644-
'custom' => __('Custom', 'mighty'),
645-
],
646-
]);
647-
648-
$repeater->add_control(
649-
'image_alignment',
650-
[
651-
'label' => __( 'Position', 'mighty' ),
652-
'type' => Controls_Manager::CHOOSE,
653-
'options' => [
654-
'column-reverse' => [
655-
'title' => __( 'Top', 'mighty' ),
656-
'icon' => 'eicon-v-align-top',
657-
],
658-
'column' => [
659-
'title' => __( 'Bottom', 'mighty' ),
660-
'icon' => 'eicon-v-align-bottom',
661-
],
662-
'row-reverse' => [
663-
'title' => __( 'Left', 'mighty' ),
664-
'icon' => 'eicon-h-align-left',
665-
],
666-
'row' => [
667-
'title' => __( 'Right', 'mighty' ),
668-
'icon' => 'eicon-h-align-right',
669-
],
670-
],
671-
'default' => 'right',
672-
'toggle' => true,
673-
'condition' => [
674-
'image_position' => 'custom'
675-
],
676-
]
677-
);
678-
679-
$repeater->add_control(
680-
'horizontal_alignment',
681-
[
682-
'label' => __( 'Horizontal Alignment', 'mighty' ),
683-
'type' => Controls_Manager::CHOOSE,
684-
'options' => [
685-
'flex-start' => [
686-
'title' => __( 'Left', 'mighty' ),
687-
'icon' => 'eicon-h-align-left',
688-
],
689-
'center' => [
690-
'title' => __( 'Center', 'mighty' ),
691-
'icon' => 'eicon-h-align-center',
692-
],
693-
'flex-end' => [
694-
'title' => __( 'Right', 'mighty' ),
695-
'icon' => 'eicon-h-align-right',
696-
],
697-
],
698-
'condition' => [
699-
'image_position' => 'custom',
700-
'image_alignment' => [ 'column-reverse', 'column' ],
701-
],
702-
'default' => 'center',
703-
'toggle' => true,
704-
]
705-
);
706-
707-
$repeater->add_control(
708-
'vertical_alignment',
709-
[
710-
'label' => __( 'Vertical Alignment', 'mighty' ),
711-
'type' => Controls_Manager::CHOOSE,
712-
'options' => [
713-
'flex-start' => [
714-
'title' => __( 'Top', 'mighty' ),
715-
'icon' => 'eicon-v-align-top',
716-
],
717-
'center' => [
718-
'title' => __( 'Middle', 'mighty' ),
719-
'icon' => ' eicon-v-align-middle',
720-
],
721-
'flex-end' => [
722-
'title' => __( 'Bottom', 'mighty' ),
723-
'icon' => 'eicon-v-align-bottom',
724-
],
725-
],
726-
'condition' => [
727-
'image_position' => 'custom',
728-
'image_alignment' => [ 'row-reverse', 'row' ],
729-
],
730-
'default' => 'middle',
731-
'toggle' => true,
732-
]
733-
);
734637

735638
$repeater->add_control(
736639
'step_image_link',
@@ -2214,9 +2117,6 @@ protected function register_controls() {
22142117
],
22152118
'default' => 'row',
22162119
'toggle' => true,
2217-
'selectors' => [
2218-
'{{WRAPPER}} .mt-how-to-step.mt-has-img' => 'flex-direction: {{VALUE}};',
2219-
],
22202120
]
22212121
);
22222122

@@ -2285,7 +2185,7 @@ protected function register_controls() {
22852185
[
22862186
'label' => __( 'Image Width', 'mighty' ),
22872187
'type' => Controls_Manager::SLIDER,
2288-
'size_units' => [ '%', 'px' , 'em' ],
2188+
'size_units' => [ '%', 'px', 'em' ],
22892189
'range' => [
22902190
'%' => [
22912191
'min' => 1,
@@ -2335,10 +2235,10 @@ protected function register_controls() {
23352235
'size' => 10,
23362236
],
23372237
'selectors' => [
2338-
'{{WRAPPER}} .mt-how-to-step-column-reverse' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2339-
'{{WRAPPER}} .mt-how-to-step-row' => 'margin-left: {{SIZE}}{{UNIT}}',
2340-
'{{WRAPPER}} .mt-how-to-step-column' => 'margin-top: {{SIZE}}{{UNIT}}',
2341-
'{{WRAPPER}} .mt-how-to-step-row-reverse' => 'margin-right: {{SIZE}}{{UNIT}}',
2238+
'{{WRAPPER}} .mt-step-img-top .mt-how-to-step-image' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2239+
'{{WRAPPER}} .mt-step-img-right .mt-how-to-step-image' => 'margin-left: {{SIZE}}{{UNIT}}',
2240+
'{{WRAPPER}} .mt-step-img-bottom .mt-how-to-step-image' => 'margin-top: {{SIZE}}{{UNIT}}',
2241+
'{{WRAPPER}} .mt-step-img-left .mt-how-to-step-image' => 'margin-right: {{SIZE}}{{UNIT}}',
23422242
],
23432243
]
23442244
);
@@ -2367,9 +2267,9 @@ protected function get_how_to_json_ld() {
23672267
$supplies = $settings['supply_list'];
23682268
$add_tools = $settings['how_to_tool'];
23692269
$tools = $settings['tool_list'];
2370-
$step_section_title = $settings['steps_title'];
23712270
$steps_form = $settings['step_list'];
23722271
$enable_schema = true;
2272+
$image_url = '';
23732273

23742274
$y = ( 525600 * $years );
23752275
$m = ( 43200 * $months );
@@ -2445,14 +2345,14 @@ protected function get_how_to_json_ld() {
24452345
<?php
24462346
foreach ( $steps_form as $key => $step ) {
24472347
$step_id = 'step-' . $id . '-' . ( $key + 1 );
2448-
$step_image = $step['step_image_link'];
2348+
$step_image = $step['step_image'];
24492349
$step_img_url = '';
24502350

24512351
if ( ! empty( $step_image['url'] ) ) {
24522352
$step_img_url = $step_image['url'];
24532353
}
2454-
if ( isset( $step['step_link']['url'] ) && ! empty( $step['step_link']['url'] ) ) {
2455-
$meta_link = $step['step_link']['url'];
2354+
if ( isset( $step['step_image_link']['url'] ) && ! empty( $step['step_image_link']['url'] ) ) {
2355+
$meta_link = $step['step_image_link']['url'];
24562356
} else {
24572357
$meta_link = get_permalink() . '#' . $step_id;
24582358
}
@@ -2521,16 +2421,30 @@ protected function render()
25212421
$estimate_time = $estimate_time . $settings['estimate_cost'] . '</span>';
25222422
}
25232423
}
2424+
2425+
$step_img_position = '';
2426+
if ( 'column-reverse' === $settings['step_image_alignment'] ) {
2427+
$step_img_position = 'mt-step-img-top';
2428+
} elseif ( 'column' === $settings['step_image_alignment'] ) {
2429+
$step_img_position = 'mt-step-img-bottom';
2430+
} elseif ( 'row' === $settings['step_image_alignment'] ) {
2431+
$step_img_position = 'mt-step-img-right';
2432+
} elseif ( 'row-reverse' === $settings['step_image_alignment'] ) {
2433+
$step_img_position = 'mt-step-img-left';
2434+
}
25242435

25252436
$this->add_render_attribute( 'mt-how-to-title', 'class', 'mt-how-to-title' );
25262437
$this->add_render_attribute( 'mt-how-to-supply-title', 'class', 'mt-how-to-supply-title' );
25272438
$this->add_render_attribute( 'mt-how-to-tools-title', 'class', 'mt-how-to-tools-title' );
25282439
$this->add_render_attribute( 'mt-how-to-step-title', 'class', 'mt-how-to-step-title' );
25292440
$this->add_render_attribute( 'mt-how-to-step-section-title', 'class', 'mt-how-to-step-section-title' );
2441+
if ( $settings['step_image_alignment'] == 'row' || $settings['step_image_alignment'] == 'row-reverse' ) {
25302442
$this->add_render_attribute( 'mt-how-to-step-content', 'style', 'width:calc(100% - '. $settings['step_image_width']['size'].'%);' );
2443+
}
25312444
$this->add_render_attribute( 'mt-how-to-step-content', 'class', 'mt-how-to-step-content' );
25322445
$this->add_render_attribute( 'mt-how-to-step', 'class', 'mt-how-to-step' );
25332446
$this->add_render_attribute( 'mt-how-to-step', 'class', 'mt-has-img' );
2447+
$this->add_render_attribute( 'mt-how-to-step', 'class', $step_img_position );
25342448

25352449
?>
25362450

@@ -2614,13 +2528,8 @@ protected function render()
26142528

26152529
<?php foreach ( $settings['step_list'] as $key => $value ) { ?>
26162530

2617-
<?php if ( $value['image_position'] == 'custom' ) { ?>
2618-
2619-
<div <?php echo $this->get_render_attribute_string('mt-how-to-step'); ?> style="flex-direction:<?php echo $value['image_alignment'];?>">
2620-
2621-
<?php } else { ?>
26222531
<div <?php echo $this->get_render_attribute_string('mt-how-to-step'); ?> >
2623-
<?php } ?>
2532+
26242533
<div <?php echo $this->get_render_attribute_string('mt-how-to-step-content'); ?>>
26252534
<?php if ( !empty( $value['step_title'] ) ) { ?>
26262535
<?php if ( !empty($value['step_image_link']['url'] ) ) { ?>
@@ -2657,34 +2566,20 @@ protected function render()
26572566

26582567
<?php } ?>
26592568

2660-
<?php if ( $value['image_position'] == 'custom' && ( $value['image_alignment'] == 'column-reverse' || $value['image_alignment'] == 'column' ) ) { ?>
2661-
2662-
<div class="mt-how-to-step-image mt-how-to-step-<?php echo $value['image_alignment'];?>" style="align-self:<?php echo $value['horizontal_alignment'];?>">
2663-
2664-
<?php } elseif( $value['image_position'] == 'custom' && ( $value['image_alignment'] == 'row-reverse' || $value['image_alignment'] == 'row' ) ) { ?>
2665-
2666-
<div class="mt-how-to-step-image mt-how-to-step-<?php echo $value['image_alignment'];?>" style="align-self:<?php echo $value['vertical_alignment'];?>">
2667-
2668-
<?php } else { ?>
2669-
2670-
<div class="mt-how-to-step-image mt-how-to-step-<?php echo $settings['step_image_alignment'];?>">
2569+
<div class="mt-how-to-step-image">
26712570

2672-
<?php } ?>
2673-
<?php if ( 'no' !== $settings['step_enable_lightbox'] ) {
2674-
echo '<a ' . wp_kses_post( $this->get_render_attribute_string( $link_key ) ) . '>';
2675-
} ?>
2571+
<?php if ( 'no' !== $settings['step_enable_lightbox'] ) {
2572+
echo '<a ' . wp_kses_post( $this->get_render_attribute_string( $link_key ) ) . '>';
2573+
} ?>
26762574
<img src="<?php echo $value['step_image']['url'];?>" alt="Place Step Title Here" title="<?php echo $settings['steps_title'];?>" >
2677-
<?php if ( 'no' !== $settings['step_enable_lightbox'] ) {
2678-
echo '</a>';
2679-
} ?>
2575+
<?php if ( 'no' !== $settings['step_enable_lightbox'] ) {
2576+
echo '</a>';
2577+
} ?>
26802578
</div>
2681-
2579+
26822580
</div>
2683-
2684-
<?php } ?>
2685-
2581+
<?php } ?>
26862582
</div>
2687-
26882583
</div>
26892584

26902585
<?php }

0 commit comments

Comments
 (0)