AMP for WP – Accelerated Mobile Pages - Version 0.9.61

Version Description

(10th September 2017) = * View more details on https://ampforwp.com/options-restructured/ * Options Panel Restructured Options were dividing into two parts: Settings and Appearance. * AMP Theme Framework Core Support Added. You can now create themes of your own in just minutes. * WPML Static Front Page Support #1111 * Notification message disables when CF7 & gravity form is activated. #1107 * Space after On in Design 3 #1114

Download this release

Release Info

Developer mohammed_kaludi
Plugin Icon 128x128 AMP for WP – Accelerated Mobile Pages
Version 0.9.61
Comparing to
See all releases

Code changes from version 0.9.60 to 0.9.61

accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 0.9.60
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -18,7 +18,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
- define('AMPFORWP_VERSION','0.9.60');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
@@ -331,7 +331,7 @@ if ( is_admin() ) {
331
  if ( ! function_exists( 'ampforwp_plugin_settings_link' ) ) {
332
 
333
  // Deactivate Parent Plugin notice
334
- // add_filter( 'plugin_action_links', 'ampforwp_plugin_settings_link', 10, 5 );
335
 
336
  function ampforwp_plugin_settings_link( $actions, $plugin_file ) {
337
  static $plugin;
@@ -340,7 +340,8 @@ if ( is_admin() ) {
340
  if ($plugin == $plugin_file) {
341
  $settings = array('settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'accelerated-mobile-pages') . '</a> | <a href="https://ampforwp.com/priority-support/#utm_source=options-panel&utm_medium=extension-tab_priority_support&utm_campaign=AMP%20Plugin">' . __('Premium Support', 'accelerated-mobile-pages') . '</a>');
342
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
343
- if ( is_plugin_active( 'amp/amp.php' ) ) {
 
344
  //if parent plugin is activated
345
  $actions = array_merge( $actions, $settings );
346
  } else{
@@ -350,7 +351,7 @@ if ( is_admin() ) {
350
  $please_activate_parent_plugin = array(__('Please Activate Parent plugin','accelerated-mobile-pages') => '<a href="'.get_admin_url() .'index.php?page=ampforwp-welcome-page">' . __('<span style="color:#b30000">'.__('Action Required: Continue Installation','accelerated-mobile-pages').'</span>', 'accelerated-mobile-pages') . '</a>');
351
  $actions = array_merge( $please_activate_parent_plugin,$actions );
352
  }
353
- }
354
 
355
  }
356
  return $actions;
@@ -553,4 +554,10 @@ function ampforwp_update_notice() {
553
 
554
  <?php
555
  //update_option( 'AMPforwp_db_version', $ampforWPCurrentVersion );
556
- }
 
 
 
 
 
 
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 0.9.61
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
21
+ define('AMPFORWP_VERSION','0.9.61');
22
  // any changes to AMP_QUERY_VAR should be refelected here
23
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
24
 
331
  if ( ! function_exists( 'ampforwp_plugin_settings_link' ) ) {
332
 
333
  // Deactivate Parent Plugin notice
334
+ add_filter( 'plugin_action_links', 'ampforwp_plugin_settings_link', 10, 5 );
335
 
336
  function ampforwp_plugin_settings_link( $actions, $plugin_file ) {
337
  static $plugin;
340
  if ($plugin == $plugin_file) {
341
  $settings = array('settings' => '<a href="admin.php?page=amp_options&tab=8">' . __('Settings', 'accelerated-mobile-pages') . '</a> | <a href="https://ampforwp.com/priority-support/#utm_source=options-panel&utm_medium=extension-tab_priority_support&utm_campaign=AMP%20Plugin">' . __('Premium Support', 'accelerated-mobile-pages') . '</a>');
342
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
343
+ $actions = array_merge( $actions, $settings );
344
+ /*if ( is_plugin_active( 'amp/amp.php' ) ) {
345
  //if parent plugin is activated
346
  $actions = array_merge( $actions, $settings );
347
  } else{
351
  $please_activate_parent_plugin = array(__('Please Activate Parent plugin','accelerated-mobile-pages') => '<a href="'.get_admin_url() .'index.php?page=ampforwp-welcome-page">' . __('<span style="color:#b30000">'.__('Action Required: Continue Installation','accelerated-mobile-pages').'</span>', 'accelerated-mobile-pages') . '</a>');
352
  $actions = array_merge( $please_activate_parent_plugin,$actions );
353
  }
354
+ }*/
355
 
356
  }
357
  return $actions;
554
 
555
  <?php
556
  //update_option( 'AMPforwp_db_version', $ampforWPCurrentVersion );
557
+ }
558
+
559
+ if(!defined('AMP_FRAMEWORK_COMOPNENT_DIR_PATH')){
560
+ define('AMP_FRAMEWORK_COMOPNENT_DIR_PATH', plugin_dir_path( __FILE__ )."/components");
561
+ }
562
+
563
+ require_once( AMP_FRAMEWORK_COMOPNENT_DIR_PATH . '/components-core.php' );
components/author-box/author-box.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_author_box( $author_url){
3
+ global $post;
4
+ $author_avatar_url = $author_url;
5
+ $post_author = get_userdata($post->post_author);
6
+ if($author_avatar_url == null){
7
+ $author_avatar_url = get_avatar_url( $post_author->user_email, array( 'size' => 70 ) );
8
+ } ?>
9
+ <div class="amp-author">
10
+ <amp-img src="<?php echo $author_avatar_url; ?>" width="70" height="70" layout="fixed"></amp-img>
11
+ <strong><?php echo esc_html( $post_author->display_name ); ?></strong>
12
+ <?php echo $post_author->description; ?>
13
+ </div>
14
+ <?php }
components/call-now/call-now.php ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ add_action('amp_call_button','amp_call_button_html_output');
3
+ function amp_call_button_html_output(){
4
+ global $redux_builder_amp;
5
+ if ( $redux_builder_amp['ampforwp-callnow-button'] ) { ?>
6
+ <div class="amp-phone">
7
+ <a href="tel:<?php echo $redux_builder_amp['enable-amp-call-numberfield']; ?>"></a>
8
+ </div> <?php
9
+ }
10
+ }
11
+ add_action('amp_post_template_css','amp_callnow_styles',11);
12
+ function amp_callnow_styles(){
13
+ global $redux_builder_amp; if ($redux_builder_amp['ampforwp-callnow-button']) { ?>
14
+ .amp-phone{ position:relative }
15
+ .amp-phone a:before { content: ""; display:inline-block; width: 4px; height: 8px; border-width: 6px 0 6px 3px; border-style: solid; border-color:<?php echo $redux_builder_amp['amp-opt-color-rgba-colorscheme-call']['color']; ?>; background: transparent; transform: rotate(-30deg); box-sizing: initial; border-top-left-radius: 3px 5px; border-bottom-left-radius: 3px 5px; }
16
+ <?php }} ?>
components/categories-tags/categories-tags.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ TODO: 1: Connect with options panel(archive support and translational panel)
4
+ 2: Do we have to change the classes names as well?
5
+ */
6
+ global $post;
7
+ function ampforwp_framework_get_categories_list(){
8
+ $ampforwp_categories = get_the_terms( $post->ID, 'category' );
9
+ if ( $ampforwp_categories ) : ?>
10
+ <div class="amp-category">
11
+ <span>Categories:</span>
12
+ <?php foreach ($ampforwp_categories as $cat ) {
13
+ //if($redux_builder_amp['ampforwp-archive-support']){
14
+ echo ('<span class="amp-cat-'.$cat->term_id.'"><a href="'.trailingslashit( trailingslashit( get_category_link( $cat->term_id ) ) . AMPFORWP_AMP_QUERY_VAR ) .'" > '. $cat->name .'</a></span>');//#934
15
+ //} else {
16
+ // echo '<span>'. $cat->name .'</span>';
17
+ //}
18
+ } ?>
19
+ </div>
20
+ <?php endif;
21
+ }
22
+ function ampforwp_framework_get_tags_list(){
23
+
24
+ $ampforwp_tags= get_the_terms( $post->ID, 'post_tag' );
25
+ if ( $ampforwp_tags && ! is_wp_error( $ampforwp_tags ) ) :?>
26
+ <div class="amp-tags">
27
+ <?php /* if($redux_builder_amp['amp-rtl-select-option']==0) {
28
+ global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-tags-text'] .' ', 'accelerated-mobile-pages' ));
29
+ }*/
30
+ ?>
31
+ <span>Tags:</span>
32
+ <?php foreach ($ampforwp_tags as $tag) {
33
+ //if($redux_builder_amp['ampforwp-archive-support']){
34
+ echo ('<span class="amp-tag-'.$tag->term_id.'"><a href="'.trailingslashit( trailingslashit( get_tag_link( $tag->term_id ) ) .'amp' ).'" >'.$tag->name .'</a></span>');//#934
35
+ //} else {
36
+ // echo ('<span>'.$tag->name.'</span>');
37
+ //}
38
+ }
39
+ /* if($redux_builder_amp['amp-rtl-select-option']) {
40
+ global $redux_builder_amp; printf( ampforwp_translation($redux_builder_amp['amp-translator-tags-text'] .' ', 'accelerated-mobile-pages' ));
41
+ }*/ ?>
42
+ </div>
43
+ <?php endif;
44
+ }
components/comments/comments.php ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_comments(){
3
+ global $redux_builder_amp;
4
+ if ( !comments_open() ){
5
+ return;
6
+ }
7
+ if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
8
+ echo ampforwp_framework_get_facebook_comments();
9
+ }
10
+ elseif ( $redux_builder_amp['ampforwp-disqus-comments-support'] ) {
11
+ ampforwp_framework_get_disqus_comments();
12
+ }
13
+ else {
14
+ if (!comments_open() || $redux_builder_amp['ampforwp-disqus-comments-support'] || $redux_builder_amp['ampforwp-facebook-comments-support']) {
15
+ return;
16
+ }
17
+ ?>
18
+ <div class="amp-comments">
19
+ <?php
20
+ global $redux_builder_amp;
21
+ // Gather comments for a specific page/post
22
+ $postID = get_the_ID();
23
+ $comments = get_comments(array(
24
+ 'post_id' => $postID,
25
+ 'status' => 'approve' //Change this to the type of comments to be displayed
26
+ ));
27
+ if ( $comments ) { ?>
28
+ <div class="amp-comments-wrapper">
29
+ <h3><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-view-comments-text'], 'View Comments' )?></h3>
30
+ <ul>
31
+ <?php
32
+ // Display the list of comments
33
+ function ampforwp_custom_translated_comment($comment, $args, $depth){
34
+ $GLOBALS['comment'] = $comment;
35
+ global $redux_builder_amp;
36
+ ?>
37
+ <li id="li-comment-<?php comment_ID() ?>"
38
+ <?php comment_class(); ?> >
39
+ <article id="comment-<?php comment_ID(); ?>" class="comment-body">
40
+ <footer class="comment-meta">
41
+ <div class="comment-author vcard">
42
+ <?php
43
+ printf(__('<b class="fn">%s</b> <span class="says">'.ampforwp_translation($redux_builder_amp['amp-translator-says-text'],'says').':</span>'), get_comment_author_link()) ?>
44
+ </div>
45
+ <div class="comment-metadata">
46
+ <a href="<?php echo htmlspecialchars( trailingslashit( get_comment_link( $comment->comment_ID ) ) ) ?>">
47
+ <?php printf( ampforwp_translation( ('%1$s '. ampforwp_translation($redux_builder_amp['amp-translator-at-text'],'at').' %2$s'), '%1$s at %2$s') , get_comment_date(), get_comment_time())?>
48
+ </a>
49
+ <?php edit_comment_link( ampforwp_translation( $redux_builder_amp['amp-translator-Edit-text'], 'Edit' ) ) ?>
50
+ </div>
51
+ </footer>
52
+ <div class="comment-content">
53
+ <?php
54
+ $comment_content = get_comment_text();
55
+ $comment_content = wpautop( $comment_content );
56
+ $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array( 'AMP_Img_Sanitizer' => array(),
57
+ 'AMP_Video_Sanitizer' => array() ) ) );
58
+ $sanitized_comment_content = $sanitizer->get_amp_content();
59
+ echo make_clickable( $sanitized_comment_content ); ?>
60
+ </div>
61
+ </article>
62
+ </li>
63
+ <?php }
64
+ wp_list_comments( array(
65
+ //Allow comment pagination
66
+ 'per_page' => AMPFORWP_COMMENTS_PER_PAGE ,
67
+ 'style' => 'li',
68
+ 'type' => 'comment',
69
+ 'max_depth' => 5,
70
+ 'avatar_size' => 0,
71
+ 'callback' => 'ampforwp_custom_translated_comment',
72
+ 'reverse_top_level' => true //Show the latest comments at the top of the list
73
+ ), $comments); ?>
74
+ </ul>
75
+ </div>
76
+ <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
77
+ if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
78
+ <div class="amp-comment-button">
79
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
80
+ </div>
81
+ <?php } ?>
82
+ <?php
83
+ } else {
84
+ global $redux_builder_amp ;
85
+ if (!comments_open()) {
86
+ return;
87
+ } ?>
88
+ <?php include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
89
+ if( ! is_plugin_active( 'amp-comments/amp-comments.php' ) ) { ?>
90
+ <div class="amp-comment-button">
91
+ <a href="<?php echo ampforwp_comment_button_url(); ?>" rel="nofollow"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-leave-a-comment-text'], 'Leave a Comment' ); ?></a>
92
+ </div>
93
+ <?php } ?>
94
+ <?php } ?>
95
+ </div>
96
+ <?php do_action('ampforwp_after_comment_hook',$this);
97
+
98
+ }
99
+
100
+ }
101
+
102
+ //Facebook Comments
103
+ function ampforwp_framework_get_facebook_comments(){
104
+ global $redux_builder_amp;
105
+ $facebook_comments_markup = '';
106
+ if ( !comments_open() ){
107
+ return;
108
+ }
109
+ if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
110
+ $facebook_comments_markup = '<section class="amp-facebook-comments">';
111
+ $facebook_comments_markup .= '<amp-facebook-comments width=486 height=357
112
+ layout="responsive" data-numposts=';
113
+ $facebook_comments_markup .= '"'. $redux_builder_amp['ampforwp-number-of-fb-no-of-comments']. '" ';
114
+
115
+ $facebook_comments_markup .= 'data-href=" ' . get_permalink() . ' "';
116
+ $facebook_comments_markup .= '></amp-facebook-comments>';
117
+
118
+ return $facebook_comments_markup;
119
+ }
120
+ }
121
+
122
+ //Disqus Comments
123
+ function ampforwp_framework_get_disqus_comments(){
124
+ global $redux_builder_amp;
125
+ if ( !comments_open() ){
126
+ return;
127
+ }//931
128
+ if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
129
+ global $post; $post_slug=$post->post_name;
130
+
131
+ $disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
132
+
133
+ if( $redux_builder_amp['ampforwp-disqus-host-position'] == 0 ) {
134
+ $disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
135
+ }
136
+
137
+ $disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.get_permalink().'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
138
+ ?>
139
+ <section class="amp-disqus-comments">
140
+ <amp-iframe
141
+ height=200
142
+ width=300
143
+ layout="responsive"
144
+ sandbox="allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts"
145
+ frameborder="0"
146
+ src="<?php echo $disqus_url ?>" >
147
+ <div overflow tabindex="0" role="button" aria-label="Read more"><?php echo __('Disqus Comments Loading...','accelerated-mobile-pages') ?></div>
148
+ </amp-iframe>
149
+ </section>
150
+ <?php
151
+ }
152
+ }
153
+
154
+ // Comments Scripts
155
+ add_filter( 'amp_post_template_data', 'ampforwp_framework_comments_scripts' );
156
+ function ampforwp_framework_comments_scripts( $data ) {
157
+
158
+ $facebook_comments_check = ampforwp_framework_get_facebook_comments();
159
+ global $redux_builder_amp;
160
+ if ( $facebook_comments_check && $redux_builder_amp['ampforwp-facebook-comments-support'] && is_singular() ) {
161
+ if ( empty( $data['amp_component_scripts']['amp-facebook-comments'] ) ) {
162
+ $data['amp_component_scripts']['amp-facebook-comments'] = 'https://cdn.ampproject.org/v0/amp-facebook-comments-0.1.js';
163
+ }
164
+ }
165
+ if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && is_singular() && comments_open() ) {
166
+ if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
167
+ if ( empty( $data['amp_component_scripts']['amp-iframe'] ) ) {
168
+ $data['amp_component_scripts']['amp-iframe'] = 'https://cdn.ampproject.org/v0/amp-iframe-0.1.js';
169
+ }
170
+ }
171
+ }
172
+ return $data;
173
+ }
components/components-core.php ADDED
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $loadComponent = array();
3
+ $scriptComponent = array();
4
+ $supportComponent = array('AMP-search','AMP-menu','AMP-logo','AMP-social-icons','AMP-sidebar','AMP-featured-image','AMP-author-box','AMP-loop','AMP-categories-tags','AMP-comments','AMP-post-navigation','AMP-related-posts','AMP-post-pagination','AMP-call-now');
5
+ //$removeScriptComponent = array('amp-carousel');
6
+ add_filter( 'amp_post_template_data', 'ampforwp_framework_add_and_form_scripts',20);
7
+ function ampforwp_framework_add_and_form_scripts($data) {
8
+ global $scriptComponent, $loadComponent; //$removeScriptComponent;
9
+
10
+ if(count($scriptComponent)>0){
11
+ foreach ($scriptComponent as $key => $value) {
12
+ if ( empty( $data['amp_component_scripts'][$key] ) ) {
13
+ $data['amp_component_scripts'][$key] = $value;
14
+ }
15
+ }
16
+ }
17
+ /*if(count($removeScriptComponent)>0){
18
+ foreach ($removeScriptComponent as $key => $value) {
19
+ if ( empty( $data['amp_component_scripts'][$key] ) ) {
20
+ unset($data['amp_component_scripts']['$key']);
21
+ }
22
+ }
23
+ }*/
24
+ return $data;
25
+ }
26
+
27
+ //Component Loader
28
+ function add_amp_theme_support($componentName){
29
+ global $wpdb;
30
+ global $loadComponent,$supportComponent;
31
+ if($supportComponent){
32
+ if(in_array($componentName, $supportComponent)){
33
+ $loadComponent[$componentName] = true;
34
+ loadComponents($componentName);
35
+ return true;
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+ //Include the Component file
41
+ function loadComponents($componentName){
42
+ global $wpdb;
43
+ if(empty($componentName)) return '';
44
+ $componentName = str_replace("AMP-", "", $componentName);
45
+
46
+ $file = AMP_FRAMEWORK_COMOPNENT_DIR_PATH.'/'.$componentName.'/'.$componentName.".php";
47
+ if(!file_exists($file)){
48
+ return '';
49
+ }
50
+ include_once($file);
51
+ }
52
+
53
+ /**
54
+ * Component Functions
55
+ **/
56
+
57
+ //Search Component Utilities
58
+ function amp_search(){
59
+ global $loadComponent;
60
+ if(isset($loadComponent['AMP-search']) && $loadComponent['AMP-search']==true){
61
+ ampforwp_framework_get_search_form();
62
+ }
63
+ }
64
+
65
+ // Logo Component Utilitis
66
+ function amp_logo(){
67
+ global $loadComponent;
68
+ if(isset($loadComponent['AMP-logo']) && $loadComponent['AMP-logo']==true){
69
+ ampforwp_framework_get_logo();
70
+ }
71
+ }
72
+
73
+ // Title
74
+ function amp_title(){
75
+ global $redux_builder_amp, $post;
76
+ $ID = '';
77
+ if(is_home() && $redux_builder_amp['amp-frontpage-select-option'] == 1){
78
+ if( $redux_builder_amp['ampforwp-title-on-front-page'] ) {
79
+ $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
80
+ }
81
+ }
82
+ else
83
+ $ID = $post->ID;
84
+ if( $ID!=null ){
85
+ do_action('ampforwp_above_the_title',$this); ?>
86
+ <h1 class="amp-post-title"> <?php
87
+ $ampforwp_title = get_the_title($ID);
88
+ $ampforwp_title = apply_filters('ampforwp_filter_single_title', $ampforwp_title);
89
+ echo wp_kses_data( $ampforwp_title ); ?>
90
+ </h1>
91
+ <?php do_action('ampforwp_below_the_title',$this); ?>
92
+ <?php
93
+ }
94
+ }
95
+
96
+
97
+ //Menus
98
+ function amp_menu(){
99
+ global $loadComponent;
100
+ if(isset($loadComponent['AMP-menu']) && $loadComponent['AMP-menu']==true){
101
+ amp_menu_html();
102
+ }
103
+ }
104
+
105
+ // Social Icons component
106
+ function amp_social($social_icons=""){
107
+ global $loadComponent;
108
+ $amp_social = array();
109
+ //Supported social icons
110
+ $amp_social = array('twitter','facebook','pinterest','google-plus','linkedin','youtube','instagram','reddit','VKontakte','snapchat','tumblr');
111
+ if(isset($loadComponent['AMP-social-icons']) && $loadComponent['AMP-social-icons']==true){
112
+ if($social_icons!=null){
113
+ ampforwp_framework_get_social_icons($social_icons);
114
+ }
115
+ else
116
+ ampforwp_framework_get_social_icons($amp_social);
117
+ }
118
+ }
119
+
120
+ //Sidebar
121
+ function amp_sidebar($tag='start',$data=array()){
122
+ global $loadComponent;
123
+ if(isset($loadComponent['AMP-sidebar']) && $loadComponent['AMP-sidebar']==true){
124
+ ampforwp_framework_get_sideabr($tag,$data);
125
+ }
126
+ }
127
+
128
+ //Featured Image
129
+ function amp_featured_image( ){
130
+ global $loadComponent;
131
+ if(isset($loadComponent['AMP-featured-image']) && $loadComponent['AMP-featured-image']==true){
132
+ ampforwp_framework_get_featured_image( );
133
+ }
134
+ }
135
+
136
+ // Author Box
137
+ function amp_author_box( $author_url="" ){
138
+ global $loadComponent;
139
+ if(isset($loadComponent['AMP-author-box']) && $loadComponent['AMP-author-box']==true){
140
+ ampforwp_framework_get_author_box($author_url );
141
+ }
142
+ }
143
+
144
+ // Categories List
145
+ function amp_categories_list( ){
146
+ global $loadComponent;
147
+ if(isset($loadComponent['AMP-categories-tags']) && $loadComponent['AMP-categories-tags']==true){
148
+ ampforwp_framework_get_categories_list( );
149
+ }
150
+ }
151
+ // Tags List
152
+ function amp_tags_list( ){
153
+ global $loadComponent;
154
+ if(isset($loadComponent['AMP-categories-tags']) && $loadComponent['AMP-categories-tags']==true){
155
+ ampforwp_framework_get_tags_list( );
156
+ }
157
+ }
158
+
159
+ // Comments
160
+ function amp_comments( ){
161
+ global $loadComponent;
162
+ if(isset($loadComponent['AMP-comments']) && $loadComponent['AMP-comments']==true){
163
+ ampforwp_framework_get_comments( );
164
+ }
165
+ }
166
+
167
+ // Post Navigation
168
+ function amp_post_navigation( ){
169
+ global $loadComponent;
170
+ if(isset($loadComponent['AMP-post-navigation']) && $loadComponent['AMP-post-navigation']==true){
171
+ echo ampforwp_framework_get_post_navigation( );
172
+ }
173
+ }
174
+
175
+ // Related Posts
176
+ function amp_related_posts( ){
177
+ global $loadComponent;
178
+ if(isset($loadComponent['AMP-related-posts']) && $loadComponent['AMP-related-posts']==true){
179
+ echo ampforwp_framework_get_related_posts( );
180
+ }
181
+ }
182
+
183
+ // Post Pagination
184
+ function amp_post_pagination($args='' ){
185
+ global $loadComponent;
186
+ if(isset($loadComponent['AMP-post-pagination']) && $loadComponent['AMP-post-pagination']==true){
187
+ ampforwp_framework_get_post_pagination();
188
+ }
189
+ }
190
+
191
+ // Call Now
192
+ function amp_call_now(){
193
+ global $loadComponent;
194
+ if(isset($loadComponent['AMP-call-now']) && $loadComponent['AMP-call-now']==true){
195
+ amp_call_button_html_output();
196
+ }
197
+ }
198
+
199
+ //Get Core of AMP HTML
200
+ function amp_header_core(){
201
+ $post_id = get_queried_object_id();
202
+ $thisTemplate = new AMP_Post_Template($post_id);
203
+ global $redux_builder_amp;
204
+ $html_tag_attributes = AMP_HTML_Utils::build_attributes_string( $thisTemplate->get( 'html_tag_attributes' ) );
205
+
206
+ $bodyClass = '';
207
+ if ( is_single() || is_page() ) {
208
+ $bodyClass = 'single-post';
209
+ $bodyClass .= ( is_page()? 'amp-single-page' : 'amp-single');
210
+
211
+ }
212
+ // Archive
213
+ if ( is_archive() ) {
214
+ $bodyClass = 'amp-archive';
215
+ }
216
+ $ampforwp_custom_post_page = ampforwp_custom_post_page();
217
+ // Homepage
218
+ if ( is_home() ) {
219
+
220
+ $bodyClass = 'amp-index '.esc_attr( $thisTemplate->get( 'body_class' ) );
221
+ if ($redux_builder_amp['amp-frontpage-select-option'] == 1) {
222
+ $bodyClass = 'single-post design_3_wrapper';
223
+ }
224
+ if ( $ampforwp_custom_post_page == "page" && ampforwp_name_blog_page() ) {
225
+ $current_url = home_url( $GLOBALS['wp']->request );
226
+ $current_url_in_pieces = explode( '/', $current_url );
227
+
228
+ if( in_array( ampforwp_name_blog_page() , $current_url_in_pieces ) ) {
229
+ $bodyClass = 'amp-index '.esc_attr( $thisTemplate->get( 'body_class' ) );
230
+ }
231
+ }
232
+
233
+ }
234
+ // is_search
235
+ if ( is_search() ) {
236
+ if ( 'single' === $type ) {
237
+ $bodyClass = 'amp_home_body archives_body design_3_wrapper';
238
+ }
239
+ }
240
+ ?><!doctype html>
241
+ <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $thisTemplate->get( 'html_tag_attributes' ) ); ?>>
242
+ <head>
243
+ <meta charset="utf-8">
244
+ <link rel="dns-prefetch" href="https://cdn.ampproject.org">
245
+ <?php do_action( 'amp_meta', $thisTemplate ); ?>
246
+ <?php do_action( 'amp_post_template_head', $thisTemplate ); ?>
247
+ <style amp-custom>
248
+ <?php $thisTemplate->load_parts( array( 'style' ) ); ?>
249
+ <?php do_action( 'amp_post_template_css', $thisTemplate ); ?>
250
+ <?php do_action( 'amp_css', $thisTemplate ); ?>
251
+ </style>
252
+
253
+ </head>
254
+ <body class="<?php echo $bodyClass; ?>">
255
+ <?php do_action('amp_start', $thisTemplate); ?>
256
+ <?php do_action('ampforwp_body_beginning', $thisTemplate);
257
+ }
258
+
259
+ function amp_header(){
260
+ $post_id = get_queried_object_id();
261
+ $thisTemplate = new AMP_Post_Template($post_id);
262
+ $thisTemplate->load_parts( array( 'header' ) );
263
+ do_action( 'amp_after_header', $thisTemplate );
264
+ do_action( 'ampforwp_after_header', $thisTemplate );
265
+ do_action('ampforwp_post_before_design_elements') ?>
266
+ <?php }
267
+
268
+ function amp_footer(){
269
+ $post_id = get_queried_object_id();
270
+ $thisTemplate = new AMP_Post_Template($post_id);
271
+ do_action( 'amp_before_footer', $thisTemplate );
272
+ do_action( 'amp_post_template_above_footer', $thisTemplate );
273
+ $thisTemplate->load_parts( array( 'footer' ) );
274
+
275
+ }
276
+
277
+ function amp_footer_core(){
278
+ $post_id = get_queried_object_id();
279
+ $thisTemplate = new AMP_Post_Template($post_id);
280
+ do_action( 'amp_post_template_footer', $thisTemplate );
281
+ do_action('ampforwp_global_after_footer');
282
+ do_action('amp_end',$thisTemplate);
283
+ // Close the body and Html tags ?>
284
+ </body>
285
+ </html><?php
286
+ }
287
+
288
+ function amp_non_amp_link(){
289
+ global $allowed_html;
290
+ global $redux_builder_amp;
291
+ echo wp_kses($redux_builder_amp['amp-translator-footer-text'],$allowed_html) ;
292
+ if($redux_builder_amp['amp-footer-link-non-amp-page']=='1') { ampforwp_view_nonamp(); }
293
+ }
294
+
295
+ function amp_loop_template(){
296
+ $post_id = get_queried_object_id();
297
+ $thisTemplate = new AMP_Post_Template($post_id);
298
+ do_action('amp_before_loop',$thisTemplate);
299
+ $thisTemplate->load_parts( array( 'loop' ) );
300
+ do_action('amp_after_loop',$thisTemplate);
301
+ }
302
+
303
+ // The Content
304
+ function amp_content(){
305
+ global $redux_builder_amp, $post;
306
+ $post_id = get_queried_object_id();
307
+ if(is_home() && $redux_builder_amp['amp-frontpage-select-option'] == 1){
308
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
309
+ }
310
+ $thisTemplate = new AMP_Post_Template($post_id);
311
+ ?>
312
+ <div>
313
+ <?php do_action('ampforwp_before_post_content');
314
+ $amp_custom_content_enable = get_post_meta( $thisTemplate->get( 'post_id' ) , 'ampforwp_custom_content_editor_checkbox', true);
315
+ // Normal Content
316
+ if ( ! $amp_custom_content_enable ) {
317
+ $ampforwp_the_content = $thisTemplate->get( 'post_amp_content' ); // amphtml content; no kses
318
+ } else {
319
+ // Custom/Alternative AMP content added through post meta
320
+ $ampforwp_the_content = $thisTemplate->get( 'ampforwp_amp_content' );
321
+ }
322
+ $ampforwp_the_content = apply_filters('ampforwp_content_filter',$ampforwp_the_content);
323
+ echo $ampforwp_the_content;
324
+ do_action('ampforwp_after_post_content'); ?>
325
+ </div>
326
+ <?php }
327
+
328
+ //Load font Compoment
329
+ $fontComponent = array();
330
+ function amp_post_load_custom_fonts(){
331
+ global $fontComponent;
332
+ if(count($fontComponent)){
333
+ $fontComponent = array_unique($fontComponent);
334
+ foreach ($fontComponent as $key => $value) {
335
+ ?>
336
+ <link rel="stylesheet" href="<?php echo esc_url( $value ); ?>">
337
+ <?php
338
+ }
339
+ }
340
+
341
+ }
342
+ add_action( 'amp_meta', 'amp_post_load_custom_fonts');
343
+ function amp_font($fontName){
344
+ global $fontComponent;
345
+ $fontComponent[] = $fontName;
346
+ }
components/featured-image/featured-image.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_featured_image(){
3
+ global $post, $redux_builder_amp;
4
+ $post_id = $post->ID;
5
+ if(is_home() && $redux_builder_amp['amp-frontpage-select-option'] == 1){
6
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
7
+ }
8
+ if (has_post_thumbnail( $post_id ) ): ?>
9
+ <figure class="amp-featured-image"> <?php
10
+ $thumb_id = get_post_thumbnail_id($post_id);
11
+ $image = wp_get_attachment_image_src( $thumb_id, 'full' );
12
+ $caption = get_the_post_thumbnail_caption( $post_id );
13
+ $thumb_alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true);
14
+ if($thumb_alt){
15
+ $alt = $thumb_alt;
16
+ }
17
+ else{
18
+ $alt = get_the_title( $post_id );
19
+ }
20
+ ?>
21
+ <amp-img src="<?php echo $image[0]; ?>" width="<?php echo $image[1]; ?>" height="<?php echo $image[2]; ?>" layout=responsive alt="<?php echo esc_attr($alt); ?>" > </amp-img>
22
+ <?php if ( $caption ) : ?>
23
+ <p class="wp-caption-text">
24
+ <?php echo wp_kses_data( $caption ); ?>
25
+ </p>
26
+ <?php endif; ?>
27
+ </figure>
28
+ <?php endif;
29
+ }
components/logo/logo.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_logo(){
3
+ global $redux_builder_amp; ?>
4
+ <div class="amp-logo">
5
+ <?php
6
+ do_action('ampforwp_header_top_design3');
7
+ $set_rel_to_noamp=false;
8
+
9
+ if( $redux_builder_amp['amp-on-off-support-for-non-amp-home-page'] ) {
10
+ if( $redux_builder_amp['amp-mobile-redirection'] ) {
11
+ $ampforwp_home_url = trailingslashit( get_bloginfo('url') ).'?nonamp=1';
12
+ $set_rel_to_noamp = true;
13
+ } else {
14
+ $ampforwp_home_url = trailingslashit( get_bloginfo('url') );
15
+ }
16
+ } else {
17
+ if($redux_builder_amp['ampforwp-homepage-on-off-support']) {
18
+ $ampforwp_home_url = trailingslashit( trailingslashit( get_bloginfo('url') ) . AMPFORWP_AMP_QUERY_VAR );
19
+ } else {
20
+ if( $redux_builder_amp['amp-mobile-redirection'] ) {
21
+ $ampforwp_home_url = trailingslashit( get_bloginfo('url') ).'?nonamp=1';
22
+ $set_rel_to_noamp = true;
23
+ } else {
24
+ $ampforwp_home_url = trailingslashit( get_bloginfo('url') );
25
+ }
26
+ }
27
+ }?>
28
+
29
+ <?php if ( true == ($redux_builder_amp['opt-media']['url']) ) { ?>
30
+ <a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){ echo ' rel="nofollow"'; } ?> >
31
+
32
+ <?php if($redux_builder_amp['ampforwp-custom-logo-dimensions'] == true) { ?>
33
+
34
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="<?php echo $redux_builder_amp['opt-media-width']; ?>" height="<?php echo $redux_builder_amp['opt-media-height']; ?>" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
35
+
36
+ <?php } else { ?>
37
+
38
+ <amp-img src="<?php echo $redux_builder_amp['opt-media']['url']; ?>" width="190" height="36" alt="<?php bloginfo('name'); ?>" class="amp-logo"></amp-img>
39
+
40
+ <?php } ?>
41
+
42
+ </a>
43
+ <?php } else { ?>
44
+ <h1><a href="<?php echo esc_url( $ampforwp_home_url ); ?>" <?php if($set_rel_to_noamp){ echo ' rel="nofollow"'; } ?> ><?php bloginfo('name'); ?></a></h1>
45
+ <?php } ?>
46
+ </div>
47
+ <?php }
components/loop/loop.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function amp_archive_title(){
3
+ global $redux_builder_amp;
4
+ if ( is_archive() ) {
5
+ the_archive_title( '<h3 class="amp-archive-title">', '</h3>' );
6
+ the_archive_description( '<div class="amp-archive-desc">', '</div>' );
7
+ }
8
+ if(is_search()){
9
+ $label = 'You searched for:';
10
+ if(function_exists('ampforwp_translation')){
11
+ $label = ampforwp_translation( $redux_builder_amp['amp-translator-search-text'], 'You searched for:');
12
+ }
13
+ echo '<h3 class="amp-loop-label">'.$label . ' ' . get_search_query().'</h3>';
14
+ }
15
+ }
16
+
17
+ $amp_q ='';
18
+ function call_loops_standard($data=array()){
19
+ global $amp_q;
20
+ if (get_query_var( 'paged' ) ) {
21
+ $paged = get_query_var('paged');
22
+ } elseif ( get_query_var( 'page' ) ) {
23
+ $paged = get_query_var('page');
24
+ } else {
25
+ $paged = 1;
26
+ }
27
+
28
+ if ( is_archive() ) {
29
+ $exclude_ids = get_option('ampforwp_exclude_post');
30
+ $qobj = get_queried_object();
31
+ $args = array(
32
+ 'post_type' => 'post',
33
+ 'orderby' => 'date',
34
+ 'ignore_sticky_posts' => 1,
35
+ 'tax_query' => array(
36
+ array(
37
+ 'taxonomy' => $qobj->taxonomy,
38
+ 'field' => 'id',
39
+ 'terms' => $qobj->term_id,
40
+ // using a slug is also possible
41
+ // 'field' => 'slug',
42
+ // 'terms' => $qobj->name
43
+ )
44
+ ),
45
+ 'paged' => esc_attr($paged),
46
+ 'post__not_in' => $exclude_ids,
47
+ 'has_password' => false ,
48
+ 'post_status'=> 'publish'
49
+ );
50
+ $filtered_args = apply_filters('ampforwp_query_args', $args);
51
+ $amp_q = new WP_Query( $filtered_args );
52
+ }
53
+ if ( is_home() ) {
54
+ $exclude_ids = get_option('ampforwp_exclude_post');
55
+
56
+ $args = array(
57
+ 'post_type' => 'post',
58
+ 'orderby' => 'date',
59
+ 'paged' => esc_attr($paged),
60
+ 'post__not_in' => $exclude_ids,
61
+ 'has_password' => false ,
62
+ 'post_status' => 'publish'
63
+ );
64
+ $filtered_args = apply_filters('ampforwp_query_args', $args);
65
+ $amp_q = new WP_Query( $filtered_args );
66
+ }
67
+
68
+ if ( is_search() ) {
69
+ $exclude_ids = get_option('ampforwp_exclude_post');
70
+ $args = array(
71
+ 's' => get_search_query() ,
72
+ 'ignore_sticky_posts' => 1,
73
+ 'paged' => esc_attr($paged),
74
+ 'post__not_in' => $exclude_ids,
75
+ 'has_password' => false ,
76
+ 'post_status' => 'publish'
77
+ );
78
+ $amp_q = new WP_Query( $args );
79
+ }
80
+
81
+ }
82
+ //call_loops_standered();
83
+ /****
84
+ * AMP Loop Functions
85
+ *
86
+ *
87
+ *
88
+ *
89
+ *
90
+ */
91
+ //add_action("init", 'call_loops_standered');
92
+
93
+ function amp_loop($selection,$data=array()){
94
+ global $amp_q;
95
+ if(empty($amp_q) || is_null($amp_q)){
96
+ call_loops_standard();
97
+ echo "<div class='loop-wrapper'>";
98
+ }
99
+ if ( !isset($ampLoopData['no_data']) ) :
100
+ switch($selection){
101
+ case 'start':
102
+ return amp_start_loop();
103
+ break;
104
+ case 'end':
105
+ return amp_end_loop();
106
+ break;
107
+ }
108
+ else : // If no posts exist.
109
+ return false;
110
+ endif; // End loop.
111
+ }
112
+
113
+ function amp_start_loop(){
114
+ global $amp_q;
115
+ $post_status = $amp_q->have_posts();
116
+ $amp_q->the_post();
117
+ return $post_status;
118
+ }
119
+ function amp_end_loop(){
120
+ wp_reset_postdata();
121
+ echo "</div>";
122
+ }
123
+
124
+ function amp_pagination(){
125
+ global $amp_q, $redux_builder_amp;
126
+ if (get_query_var( 'paged' ) ) {
127
+ $paged = get_query_var('paged');
128
+ } elseif ( get_query_var( 'page' ) ) {
129
+ $paged = get_query_var('page');
130
+ } else {
131
+ $paged = 1;
132
+ }
133
+ $pre_link = '';
134
+ if ( $paged > 1 ) {
135
+ $pre_link = '<div class="left">'.get_previous_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-previous-posts-text'], 'Show previous Posts' ) ) .'</div>';
136
+ }
137
+
138
+ echo '<div class="loop-pagination">
139
+ <div class="right">'. get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-show-more-posts-text'] , 'Show more Posts'), $amp_q->max_num_pages ) .'</div>
140
+ '.$pre_link.'
141
+ <div class="clearfix"></div>
142
+ </div>';
143
+ }
144
+
145
+ /***
146
+ * Get Title of post
147
+ */
148
+ function amp_loop_title($data=array()){
149
+ $data = array_filter($data);
150
+ $tag = 'h2';
151
+ if(isset($data['tag']) && $data['tag']!=""){
152
+ $tag = $data['tag'];
153
+ }
154
+ $attributes = 'class="loop-title"';
155
+ if(isset($data['attributes']) && $data['attributes']!=""){
156
+ $attributes = $data['attributes'];
157
+ }
158
+ echo '<'.$tag.' '.$attributes.'>';
159
+ if(!isset($data['link']) ){
160
+ echo '<a href="'. amp_loop_permalink(true) .'">';
161
+ }
162
+ echo the_title('','',false);
163
+
164
+ if(!isset($data['link']) ){
165
+ echo '</a>';
166
+ }
167
+ echo '</'.$tag.'>';
168
+ }
169
+
170
+ function amp_loop_date(){
171
+ global $redux_builder_amp;
172
+ $post_date = human_time_diff(
173
+ get_the_time('U', get_the_ID() ),
174
+ current_time('timestamp') ) .' '. ampforwp_translation( $redux_builder_amp['amp-translator-ago-date-text'],
175
+ 'ago');
176
+
177
+ echo '<div class="loop-date">'.$post_date.'</div>';
178
+ }
179
+
180
+ function amp_loop_excerpt($no_of_words=15,$tag = 'p'){
181
+ //excerpt
182
+ if(has_excerpt()){
183
+ $content = get_the_excerpt();
184
+ }else{
185
+ $content = get_the_content();
186
+ }
187
+ $content = strip_shortcodes( $content );
188
+ echo '<'.$tag.'>'. wp_trim_words( $content, $no_of_words ) .'</'.$tag.'>';
189
+ }
190
+ function amp_loop_all_content($tag = 'p'){
191
+ $fullContent = strip_shortcodes( get_the_content() );
192
+ echo '<'.$tag.'>'. $fullContent .'</'.$tag.'>';
193
+ }
194
+
195
+ function amp_loop_permalink($return,$amp_query_var ='amp'){
196
+ if($return){
197
+ return user_trailingslashit(trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR) ;
198
+ }
199
+ echo user_trailingslashit(trailingslashit( get_permalink() ) . AMPFORWP_AMP_QUERY_VAR) ;
200
+ }
201
+ function amp_loop_image($data=array()){
202
+ global $ampLoopData,$counterOffset;
203
+ if (has_post_thumbnail() ) {
204
+ $tag = 'div';
205
+ $tag_class = '';
206
+ $imageClass = 'class =';
207
+ if(isset($data['tag']) && $data['tag']!=""){
208
+ $tag = $data['tag'];
209
+ }
210
+ if(isset($data['tag_class']) && $data['tag_class']!=""){
211
+ $tag_class = $data['tag_class'];
212
+ }
213
+ if(isset($data['image_class']) && $data['image_class']!=""){
214
+ $imageClass .= '"'.$data['image_class'].'"';
215
+ }
216
+
217
+ $thumb_id = get_post_thumbnail_id();
218
+ $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
219
+ $thumb_url = $thumb_url_array[0];
220
+
221
+
222
+ echo '<'.$tag.' class="loop-img '.$tag_class.'">';
223
+ echo '<a href="'.amp_loop_permalink(true).'">';
224
+ echo '<amp-img '.$imageClass.' layout="responsive" src="'. $thumb_url .'" width=150 height=150></amp-img>';
225
+ echo '</a>';
226
+ echo '</'.$tag.'>';
227
+ }
228
+ }
229
+
230
+ // Category
231
+ function amp_loop_category(){
232
+ echo ' <ul class="loop-category">';
233
+ if(count(get_the_category()) > 0){
234
+ foreach((get_the_category()) as $category) {
235
+ echo '<li class="amp-cat-'. $category->term_id.'">'. $category->cat_name.'</li>';
236
+ }
237
+ }
238
+ echo '</ul>';
239
+ }
240
+
241
+
242
+
243
+
components/menu/menu.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function amp_menu_html(){
3
+ if( has_nav_menu( 'amp-menu' ) ) {
4
+ wp_nav_menu( array(
5
+ 'theme_location' => 'amp-menu',
6
+ 'container'=>'aside',
7
+ 'menu'=>'ul',
8
+ 'menu_class'=>'amp-menu',
9
+ ) );
10
+ }
11
+ }
12
+
13
+ //Load styling for Menu
14
+ add_action('amp_post_template_css','amp_menu_styles',11);
15
+ function amp_menu_styles(){ ?>
16
+ aside {
17
+ width: 150px;
18
+ }
19
+ .amp-menu {
20
+ list-style-type: none;
21
+ margin: 0;
22
+ padding: 0;
23
+ }
24
+ .amp-menu li {
25
+ position: relative;
26
+ display: block;
27
+ }
28
+ .amp-menu li.menu-item-has-children ul {
29
+ display: none;
30
+ }
31
+ .amp-menu li.menu-item-has-children:hover > ul {
32
+ display: block ;
33
+ }
34
+ .amp-menu li.menu-item-has-children > ul > li {
35
+ padding-left: 10px ;
36
+ }
37
+ .amp-menu li.menu-item-has-children:after {
38
+ content: " > ";
39
+ position: absolute;
40
+ padding: 10px;
41
+ right: 0;
42
+ top: 0;
43
+ z-index: 10000;
44
+ line-height: 1;
45
+ background:#ddd
46
+ }
47
+ .amp-menu > li a {
48
+ padding: 7px;
49
+ display: block;
50
+ margin-bottom: 1px;
51
+ }
52
+ .amp-menu > li ul {
53
+ list-style-type: none;
54
+ margin: 0;
55
+ padding: 0;
56
+ position: relative;
57
+ }
58
+ .amp-menu > li > li a {
59
+ background: #e5e5e5;
60
+ }
61
+ .amp-menu > li > li a {
62
+ background: #e5e5e5;
63
+ }
64
+
65
+ .amp-menu li:hover a {
66
+ background: #fff;
67
+ }
68
+ .amp-menu li:hover li:hover > a {
69
+ background: #fff;
70
+ }
71
+ <?php }
components/post-navigation/post-navigation.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_post_navigation(){
3
+ global $redux_builder_amp;
4
+ if($redux_builder_amp['enable-single-next-prev']) { ?>
5
+ <div id="pagination">
6
+ <div class="next">
7
+ <?php $next_post = get_next_post();
8
+ if (!empty( $next_post )) {
9
+ $next_text = $next_post->post_title;
10
+ ?>
11
+ <a href="<?php echo trailingslashit( trailingslashit( get_permalink( $next_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"><?php echo apply_filters('ampforwp_next_link',$next_text ); ?> &raquo;</a> <?php
12
+ } ?>
13
+ </div>
14
+
15
+ <div class="prev">
16
+ <?php $prev_post = get_previous_post();
17
+ if (!empty( $prev_post )) {
18
+ $prev_text = $prev_post->post_title;
19
+ ?>
20
+ <a href="<?php echo trailingslashit( trailingslashit( get_permalink( $prev_post->ID ) ) . AMPFORWP_AMP_QUERY_VAR ); ?>"> &laquo; <?php echo apply_filters('ampforwp_prev_link',$prev_text ); ?></a> <?php
21
+ } ?>
22
+ </div>
23
+
24
+ <div class="clearfix"></div>
25
+ </div>
26
+ <?php }
27
+ }
components/post-pagination/post-pagination.php ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_post_pagination( $args = '' ) {
3
+
4
+ wp_reset_postdata();
5
+ global $page, $numpages, $multipage, $more, $redux_builder_amp;
6
+
7
+ $defaults = array(
8
+ 'before' => '<p>' . __( 'Page:' ),
9
+ 'after' => '</p>',
10
+ 'link_before' => '',
11
+ 'link_after' => '',
12
+ 'next_or_number' => 'number',
13
+ 'separator' => ' ',
14
+ 'nextpagelink' => __( 'Next page' ),
15
+ 'previouspagelink' => __( 'Previous page' ),
16
+ 'pagelink' => '%',
17
+ 'echo' => 1
18
+ );
19
+
20
+ $params = wp_parse_args( $args, $defaults );
21
+
22
+ /**
23
+ * Filters the arguments used in retrieving page links for paginated posts.
24
+ * @param array $params An array of arguments for page links for paginated posts.
25
+ */
26
+ $r = apply_filters( 'ampforwp_framework_get_post_pagination_args', $params );
27
+
28
+ $output = '';
29
+ if ( $multipage ) {
30
+ if ( 'number' == $r['next_or_number'] ) {
31
+ $output .= $r['before'];
32
+ for ( $i = 1; $i <= $numpages; $i++ ) {
33
+ $link = $r['link_before'] . str_replace( '%', $i, $r['pagelink'] ) . $r['link_after'];
34
+ if ( $i != $page || ! $more && 1 == $page ) {
35
+ $link = ampforwp_framework_get_post_paginated_link( $i ) . $link . '</a>';
36
+ }
37
+ /**
38
+ * Filters the HTML output of individual page number links.
39
+ * @param string $link The page number HTML output.
40
+ * @param int $i Page number for paginated posts' page links.
41
+ */
42
+ $link = apply_filters( 'ampforwp_framework_get_post_pagination_link', $link, $i );
43
+
44
+ // Use the custom links separator beginning with the second link.
45
+ $output .= ( 1 === $i ) ? ' ' : $r['separator'];
46
+ $output .= $link;
47
+ }
48
+ $output .= $r['after'];
49
+ } elseif ( $more ) {
50
+ $output .= $r['before'];
51
+ $prev = $page - 1;
52
+ if ( $prev > 0 ) {
53
+ $link = ampforwp_framework_get_post_paginated_link( $prev ) . $r['link_before'] . $r['previouspagelink'] . $r['link_after'] . '</a>';
54
+ $output .= apply_filters( 'ampforwp_framework_get_post_pagination_link', $link, $prev );
55
+ }
56
+ $next = $page + 1;
57
+ if ( $next <= $numpages ) {
58
+ if ( $prev ) {
59
+ $output .= $r['separator'];
60
+ }
61
+ $link = ampforwp_framework_get_post_paginated_link( $next ) . $r['link_before'] . $r['nextpagelink'] . $r['link_after'] . '</a>';
62
+ $output .= apply_filters( 'ampforwp_framework_get_post_pagination_link', $link, $next );
63
+ }
64
+ $output .= $r['after'];
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Filters the HTML output of page links for paginated posts.
70
+ * @param string $output HTML output of paginated posts' page links.
71
+ * @param array $args An array of arguments.
72
+ */
73
+ $html = apply_filters( 'ampforwp_framework_get_post_pagination', $output, $args );
74
+ if($redux_builder_amp['amp-pagination']) {
75
+ if ( $r['echo'] ) {
76
+ echo $html;
77
+ }
78
+ return $html;
79
+ }
80
+
81
+ }
82
+
83
+ /**
84
+ * Helper function for ampforwp_framework_get_post_pagination().
85
+ * @access private
86
+ *
87
+ * @global WP_Rewrite $wp_rewrite
88
+ *
89
+ * @param int $i Page number.
90
+ * @return string Link.
91
+ */
92
+ function ampforwp_framework_get_post_paginated_link( $i ) {
93
+ global $wp_rewrite;
94
+ $post = get_post();
95
+ $query_args = array();
96
+ if ( 1 == $i ) {
97
+ $url = get_permalink();
98
+ } else {
99
+ if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
100
+ $url = add_query_arg( 'page', $i, get_permalink() );
101
+ elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
102
+ $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
103
+ else
104
+ $url = trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged');
105
+ }
106
+
107
+ if ( is_preview() ) {
108
+
109
+ if ( ( 'draft' !== $post->post_status ) && isset( $_GET['preview_id'], $_GET['preview_nonce'] ) ) {
110
+ $query_args['preview_id'] = wp_unslash( $_GET['preview_id'] );
111
+ $query_args['preview_nonce'] = wp_unslash( $_GET['preview_nonce'] );
112
+ }
113
+
114
+ $url = get_preview_post_link( $post, $query_args, $url );
115
+ }
116
+
117
+ return '<a href="' . esc_url(trailingslashit( $url) ) . '?amp">';
118
+ }
119
+
120
+ add_filter('ampforwp_modify_rel_canonical','amp_paginated_post_modify_amphtml');
121
+ function amp_paginated_post_modify_amphtml($url) {
122
+ if(is_single()){
123
+ $post_paginated_page='';
124
+ $post_paginated_page = get_query_var('page');
125
+ if($post_paginated_page){
126
+ $url = get_permalink();
127
+ $new_url = $url."$post_paginated_page/?amp";
128
+ return $new_url;
129
+ }
130
+ }
131
+ return $url;
132
+ }
133
+
134
+ add_action('amp_post_template_head','amp_paginated_post_modify_canonical',9);
135
+ function amp_paginated_post_modify_canonical(){
136
+ if(is_single()){
137
+ $post_paginated_page='';
138
+ $post_paginated_page = get_query_var('page');
139
+ if($post_paginated_page){
140
+ remove_action( 'amp_post_template_head', 'amp_post_template_add_canonical' );
141
+ add_action('amp_post_template_head','amp_paginated_post_rel_canonical');
142
+ }
143
+ }
144
+ }
145
+ function amp_paginated_post_rel_canonical(){
146
+ $post_paginated_page='';
147
+ $new_canonical_url = '';
148
+ global $post;
149
+ $current_post_id = $post->ID;
150
+ $new_canonical_url = get_permalink($current_post_id);
151
+ $new_canonical_url = trailingslashit($new_canonical_url);
152
+ $post_paginated_page = get_query_var('page');
153
+ if($post_paginated_page){?>
154
+ <link rel="canonical" href="<?php echo $new_canonical_url.$post_paginated_page ?>/" /><?php }
155
+ }
156
+
157
+ add_filter('ampforwp_content_filter','ampforwp_post_paginated_content');
158
+ function ampforwp_post_paginated_content($content){
159
+ global $redux_builder_amp;
160
+ $ampforwp_new_content = '';
161
+ $ampforwp_the_content = '';
162
+ $ampforwp_the_content = $content;
163
+ if($redux_builder_amp['amp-pagination']) {
164
+ $ampforwp_new_content = explode('<!--nextpage-->', $ampforwp_the_content);
165
+ $queried_var = get_query_var('page');
166
+ if ( $queried_var > 1 ) {
167
+ $queried_var = $queried_var -1 ;
168
+ }
169
+ else{
170
+ $queried_var = 0;
171
+ }
172
+ return $ampforwp_new_content[$queried_var];
173
+ } else{
174
+ return $ampforwp_the_content;
175
+ }
176
+ }
components/related-posts/related-posts.php ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_related_posts(){
3
+ global $post, $redux_builder_amp;
4
+ do_action('ampforwp_above_related_post',$this); //Above Related Posts
5
+ $string_number_of_related_posts = $redux_builder_amp['ampforwp-number-of-related-posts']; $int_number_of_related_posts = round(abs(floatval($string_number_of_related_posts)));
6
+ $args = null;
7
+
8
+ if($redux_builder_amp['ampforwp-single-select-type-of-related']==2){
9
+ $categories = get_the_category($post->ID);
10
+ if ($categories) {
11
+ $category_ids = array();
12
+ foreach($categories as $individual_category) $category_ids[] = $individual_category->term_id;
13
+ $args=array(
14
+ 'category__in' => $category_ids,
15
+ 'post__not_in' => array($post->ID),
16
+ 'posts_per_page'=> $int_number_of_related_posts,
17
+ 'ignore_sticky_posts'=>1,
18
+ 'has_password' => false ,
19
+ 'post_status'=> 'publish'
20
+ );
21
+ }
22
+ }
23
+ // tags
24
+ if($redux_builder_amp['ampforwp-single-select-type-of-related']==1) {
25
+ $ampforwp_tags = get_the_tags($post->ID);
26
+ if ($ampforwp_tags) {
27
+ $tag_ids = array();
28
+ foreach($ampforwp_tags as $individual_tag) $tag_ids[] = $individual_tag->term_id;
29
+ $args=array(
30
+ 'tag__in' => $tag_ids,
31
+ 'post__not_in' => array($post->ID),
32
+ 'posts_per_page'=> $int_number_of_related_posts,
33
+ 'ignore_sticky_posts'=>1,
34
+ 'has_password' => false ,
35
+ 'post_status'=> 'publish'
36
+ );
37
+ }
38
+ }
39
+ $my_query = new wp_query( $args );
40
+ if( $my_query->have_posts() ) { ?>
41
+ <div class="amp-related-posts">
42
+ <ul class="clearfix">
43
+ <h3 class="amp-related-posts-title"><?php echo ampforwp_translation( $redux_builder_amp['amp-translator-related-text'], 'Related Post' ); ?></h3>
44
+ <?php
45
+ while( $my_query->have_posts() ) {
46
+ $my_query->the_post();
47
+ $related_post_permalink = get_permalink();
48
+ $related_post_permalink = trailingslashit($related_post_permalink);
49
+ $related_post_permalink = trailingslashit( $related_post_permalink . AMPFORWP_AMP_QUERY_VAR );
50
+ ?>
51
+ <li class="<?php if ( has_post_thumbnail() ) { echo'has_thumbnail'; } else { echo 'no_thumbnail'; } ?>">
52
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>">
53
+ <?php
54
+ $thumb_id_2 = get_post_thumbnail_id();
55
+ $thumb_url_array_2 = wp_get_attachment_image_src($thumb_id_2, 'thumbnail', true);
56
+ $thumb_url_2 = $thumb_url_array_2[0];
57
+ ?>
58
+
59
+ <?php if ( has_post_thumbnail() ) { ?>
60
+ <amp-img src="<?php echo esc_url( $thumb_url_2 ); ?>" width="150" height="150" layout="responsive"></amp-img>
61
+ <?php } ?>
62
+ </a>
63
+ <div class="related_link">
64
+ <a href="<?php echo esc_url( $related_post_permalink ); ?>"><?php the_title(); ?></a>
65
+ <?php if(has_excerpt()){
66
+ $content = get_the_excerpt();
67
+ }else{
68
+ $content = get_the_content();
69
+ }
70
+ ?>
71
+ <p><?php echo wp_trim_words( strip_shortcodes( $content ) , '15' ); ?></p>
72
+ </div>
73
+ </li>
74
+ <?php
75
+ }
76
+
77
+ } ?>
78
+ </ul>
79
+ </div>
80
+ <?php wp_reset_postdata(); ?>
81
+ <?php do_action('ampforwp_below_related_post_hook',$this);
82
+ }
components/search/search.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ //main output function
3
+ function ampforwp_framework_get_search_form() {
4
+ global $redux_builder_amp;
5
+ $action_url = '';
6
+ $label = ampforwp_translation(isset($redux_builder_amp['ampforwp-search-label']) && $redux_builder_amp['ampforwp-search-label'], 'Type your search query and hit enter');
7
+ $action_url = esc_url( get_bloginfo('url') );
8
+ $action_url = preg_replace('#^http?:#', '', $action_url);
9
+ $placeholder = ampforwp_translation($redux_builder_amp['ampforwp-search-placeholder'], 'Type Here' );
10
+ $form = '<form role="search" method="get" id="amp-search" class="amp-search" target="_top" action="' . $action_url .'">
11
+ <div class="amp-search-wrapper">
12
+ <label class="screen-reader-text" for="s">' . $label . '</label>
13
+ <input type="text" placeholder="AMP" value="1" name="amp" class="hidden"/>
14
+ <input type="text" placeholder="'.$placeholder.'" value="' . get_search_query() . '" name="s" id="s" />
15
+ <input type="submit" id="amp-search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
16
+ </div>
17
+ </form>';
18
+ echo $form;
19
+
20
+ }
21
+ ampforwp_add_scripts();
22
+ function ampforwp_add_scripts(){
23
+ global $scriptComponent;
24
+ if ( empty( $scriptComponent['amp-form'] ) ) {
25
+ $scriptComponent['amp-form'] = 'https://cdn.ampproject.org/v0/amp-form-0.1.js';
26
+ }
27
+ }
components/sidebar/sidebar.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!function_exists('ampforwp_framework_get_sideabr')){
3
+ function ampforwp_framework_get_sideabr($data=array()){
4
+ if(!isset($data['action'])){
5
+ echo 'action not found';
6
+ }
7
+ $action = $data['action'];
8
+ unset($data['action']);
9
+ switch(strtolower($action)) {
10
+ case 'start':
11
+ echo sideber_begin($data);
12
+ do_action('amp_sidebar_start');
13
+ break;
14
+ case 'end':
15
+ do_action('amp_sidebar_end');
16
+ echo sideber_end();
17
+ break;
18
+ case 'open-button':
19
+ echo sidebar_opening_button($data);
20
+ break;
21
+ case 'close-button':
22
+ echo sidebar_close_button($data);
23
+ break;
24
+ default:
25
+ echo 'action not found';
26
+ break;
27
+ }
28
+ }
29
+ }
30
+ function sidebar_close_button($data=array() ){
31
+ $id = 'sidebar';
32
+ $class = 'amp-sidebar-close';
33
+ if(isset($data['id'])){
34
+ $id = $data['id'];
35
+ }
36
+ if(isset($data['class'])){
37
+ $class .= $data['class'];
38
+ }
39
+ return '<div role="button" tabindex="0" on="tap:'.$id.'.close" class="'.$class.'">X</div>';
40
+ }
41
+ function sidebar_opening_button($data=array()){
42
+ $id = 'sidebar';
43
+ $class = 'amp-sidebar-button';
44
+ if(isset($data['id'])){
45
+ $id = $data['id'];
46
+ }
47
+ if(isset($data['class'])){
48
+ $class = $data['class'];
49
+ }
50
+ return '<div on="tap:'.$id.'.toggle" role="button" tabindex="0" class="'.$class.'">
51
+ <a href="#" class="amp-sidebar-toggle">
52
+ <span></span>
53
+ <span></span>
54
+ <span></span>
55
+ </a>
56
+ </div>';
57
+ }
58
+ function sideber_begin($data=array()){
59
+ $attribute = '';
60
+ if(count($data)>0){
61
+ foreach ($data as $key => $value) {
62
+ $attribute .= $key.'="'.$value.'" ' ;
63
+ }
64
+ }else{
65
+ $attribute = "id='sidebar' layout='nodisplay' side='right'";
66
+ }
67
+ return '<amp-sidebar '.$attribute.'>';
68
+ }
69
+
70
+ function sideber_end(){
71
+ return '</amp-sidebar>';
72
+ }
73
+ ampforwp_add_sidebar_scripts();
74
+ function ampforwp_add_sidebar_scripts(){
75
+ global $scriptComponent;
76
+ if ( empty( $scriptComponent['amp-sidebar'] ) ) {
77
+ $scriptComponent['amp-sidebar'] = 'https://cdn.ampproject.org/v0/amp-sidebar-0.1.js';
78
+ }
79
+ }
components/social-icons/fonts/icomoon.eot ADDED
Binary file
components/social-icons/fonts/icomoon.svg ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by IcoMoon</metadata>
5
+ <defs>
6
+ <font id="icomoon" horiz-adv-x="1024">
7
+ <font-face units-per-em="1024" ascent="960" descent="-64" />
8
+ <missing-glyph horiz-adv-x="1024" />
9
+ <glyph unicode="&#x20;" horiz-adv-x="512" d="" />
10
+ <glyph unicode="&#xf099;" glyph-name="twitter" horiz-adv-x="951" d="M925.714 717.714c-25.143-36.571-56.571-69.143-92.571-95.429 0.571-8 0.571-16 0.571-24 0-244-185.714-525.143-525.143-525.143-104.571 0-201.714 30.286-283.429 82.857 14.857-1.714 29.143-2.286 44.571-2.286 86.286 0 165.714 29.143 229.143 78.857-81.143 1.714-149.143 54.857-172.571 128 11.429-1.714 22.857-2.857 34.857-2.857 16.571 0 33.143 2.286 48.571 6.286-84.571 17.143-148 91.429-148 181.143v2.286c24.571-13.714 53.143-22.286 83.429-23.429-49.714 33.143-82.286 89.714-82.286 153.714 0 34.286 9.143 65.714 25.143 93.143 90.857-112 227.429-185.143 380.571-193.143-2.857 13.714-4.571 28-4.571 42.286 0 101.714 82.286 184.571 184.571 184.571 53.143 0 101.143-22.286 134.857-58.286 41.714 8 81.714 23.429 117.143 44.571-13.714-42.857-42.857-78.857-81.143-101.714 37.143 4 73.143 14.286 106.286 28.571z" />
11
+ <glyph unicode="&#xf09a;" glyph-name="facebook, facebook-f" horiz-adv-x="602" d="M548 944v-150.857h-89.714c-70.286 0-83.429-33.714-83.429-82.286v-108h167.429l-22.286-169.143h-145.143v-433.714h-174.857v433.714h-145.714v169.143h145.714v124.571c0 144.571 88.571 223.429 217.714 223.429 61.714 0 114.857-4.571 130.286-6.857z" />
12
+ <glyph unicode="&#xf0d2;" glyph-name="pinterest" horiz-adv-x="878" d="M877.714 438.857c0-242.286-196.571-438.857-438.857-438.857-43.429 0-84.571 6.286-124.571 18.286 16.571 26.286 35.429 60 44.571 93.714 0 0 5.143 19.429 30.857 120.571 14.857-29.143 59.429-54.857 106.857-54.857 141.143 0 237.143 128.571 237.143 301.143 0 129.714-110.286 251.429-278.286 251.429-208 0-313.143-149.714-313.143-274.286 0-75.429 28.571-142.857 89.714-168 9.714-4 18.857 0 21.714 11.429 2.286 7.429 6.857 26.857 9.143 34.857 2.857 11.429 1.714 14.857-6.286 24.571-17.714 21.143-29.143 48-29.143 86.286 0 110.857 82.857 210.286 216 210.286 117.714 0 182.857-72 182.857-168.571 0-126.286-56-233.143-139.429-233.143-45.714 0-80 37.714-69.143 84.571 13.143 55.429 38.857 115.429 38.857 155.429 0 36-19.429 66.286-59.429 66.286-46.857 0-84.571-48.571-84.571-113.714 0 0 0-41.714 14.286-69.714-48-203.429-56.571-238.857-56.571-238.857-8-33.143-8.571-70.286-7.429-101.143-154.857 68-262.857 222.286-262.857 402.286 0 242.286 196.571 438.857 438.857 438.857s438.857-196.571 438.857-438.857z" />
13
+ <glyph unicode="&#xf0d5;" glyph-name="google-plus" horiz-adv-x="1317" d="M821.143 429.143c0-239.429-160.571-409.143-402.286-409.143-231.429 0-418.857 187.429-418.857 418.857s187.429 418.857 418.857 418.857c113.143 0 207.429-41.143 280.571-109.714l-113.714-109.143c-30.857 29.714-85.143 64.571-166.857 64.571-142.857 0-259.429-118.286-259.429-264.571s116.571-264.571 259.429-264.571c165.714 0 228 119.429 237.714 180.571h-237.714v144h395.429c4-21.143 6.857-42.286 6.857-69.714zM1316.571 498.857v-120h-119.429v-119.429h-120v119.429h-119.429v120h119.429v119.429h120v-119.429h119.429z" />
14
+ <glyph unicode="&#xf0e1;" glyph-name="linkedin" horiz-adv-x="878" d="M199.429 593.714v-566.286h-188.571v566.286h188.571zM211.429 768.571c0.571-54.286-40.571-97.714-106.286-97.714v0h-1.143c-63.429 0-104 43.429-104 97.714 0 55.429 42.286 97.714 106.286 97.714 64.571 0 104.571-42.286 105.143-97.714zM877.714 352v-324.571h-188v302.857c0 76-27.429 128-95.429 128-52 0-82.857-34.857-96.571-68.571-4.571-12.571-6.286-29.143-6.286-46.286v-316h-188c2.286 513.143 0 566.286 0 566.286h188v-82.286h-1.143c24.571 38.857 69.143 95.429 170.857 95.429 124 0 216.571-81.143 216.571-254.857z" />
15
+ <glyph unicode="&#xf16a;" glyph-name="youtube-play" d="M406.286 306.286l276.571 142.857-276.571 144.571v-287.429zM512 798.857c215.429 0 358.286-10.286 358.286-10.286 20-2.286 64-2.286 102.857-43.429 0 0 31.429-30.857 40.571-101.714 10.857-82.857 10.286-165.714 10.286-165.714v-77.714s0.571-82.857-10.286-165.714c-9.143-70.286-40.571-101.714-40.571-101.714-38.857-40.571-82.857-40.571-102.857-42.857 0 0-142.857-10.857-358.286-10.857v0c-266.286 2.286-348 10.286-348 10.286-22.857 4-74.286 2.857-113.143 43.429 0 0-31.429 31.429-40.571 101.714-10.857 82.857-10.286 165.714-10.286 165.714v77.714s-0.571 82.857 10.286 165.714c9.143 70.857 40.571 101.714 40.571 101.714 38.857 41.143 82.857 41.143 102.857 43.429 0 0 142.857 10.286 358.286 10.286v0z" />
16
+ <glyph unicode="&#xf16d;" glyph-name="instagram" horiz-adv-x="878" d="M585.143 438.857c0 80.571-65.714 146.286-146.286 146.286s-146.286-65.714-146.286-146.286 65.714-146.286 146.286-146.286 146.286 65.714 146.286 146.286zM664 438.857c0-124.571-100.571-225.143-225.143-225.143s-225.143 100.571-225.143 225.143 100.571 225.143 225.143 225.143 225.143-100.571 225.143-225.143zM725.714 673.143c0-29.143-23.429-52.571-52.571-52.571s-52.571 23.429-52.571 52.571 23.429 52.571 52.571 52.571 52.571-23.429 52.571-52.571zM438.857 798.857c-64 0-201.143 5.143-258.857-17.714-20-8-34.857-17.714-50.286-33.143s-25.143-30.286-33.143-50.286c-22.857-57.714-17.714-194.857-17.714-258.857s-5.143-201.143 17.714-258.857c8-20 17.714-34.857 33.143-50.286s30.286-25.143 50.286-33.143c57.714-22.857 194.857-17.714 258.857-17.714s201.143-5.143 258.857 17.714c20 8 34.857 17.714 50.286 33.143s25.143 30.286 33.143 50.286c22.857 57.714 17.714 194.857 17.714 258.857s5.143 201.143-17.714 258.857c-8 20-17.714 34.857-33.143 50.286s-30.286 25.143-50.286 33.143c-57.714 22.857-194.857 17.714-258.857 17.714zM877.714 438.857c0-60.571 0.571-120.571-2.857-181.143-3.429-70.286-19.429-132.571-70.857-184s-113.714-67.429-184-70.857c-60.571-3.429-120.571-2.857-181.143-2.857s-120.571-0.571-181.143 2.857c-70.286 3.429-132.571 19.429-184 70.857s-67.429 113.714-70.857 184c-3.429 60.571-2.857 120.571-2.857 181.143s-0.571 120.571 2.857 181.143c3.429 70.286 19.429 132.571 70.857 184s113.714 67.429 184 70.857c60.571 3.429 120.571 2.857 181.143 2.857s120.571 0.571 181.143-2.857c70.286-3.429 132.571-19.429 184-70.857s67.429-113.714 70.857-184c3.429-60.571 2.857-120.571 2.857-181.143z" />
17
+ <glyph unicode="&#xf173;" glyph-name="tumblr" horiz-adv-x="624" d="M539.429 191.428l45.714-135.429c-17.143-25.714-94.857-54.857-164.571-56-207.429-3.429-285.714 147.429-285.714 253.714v310.857h-96v122.857c144 52 178.857 182.286 186.857 256.571 0.571 4.571 4.571 6.857 6.857 6.857h139.429v-242.286h190.286v-144h-190.857v-296c0-40 14.857-95.429 91.429-93.714 25.143 0.571 58.857 8 76.571 16.571z" />
18
+ <glyph unicode="&#xf189;" glyph-name="vk" horiz-adv-x="1119" d="M1095.429 653.714c8.571-23.429-18.286-78.286-85.714-168-110.857-147.429-122.857-133.714-31.429-218.857 88-81.714 106.286-121.143 109.143-126.286 0 0 36.571-64-40.571-64.571l-146.286-2.286c-31.429-6.286-73.143 22.286-73.143 22.286-54.857 37.714-106.286 135.429-146.286 122.857 0 0-41.143-13.143-40-101.143 0.571-18.857-8.571-29.143-8.571-29.143s-10.286-10.857-30.286-12.571h-65.714c-144.571-9.143-272 124-272 124s-139.429 144-261.714 431.429c-8 18.857 0.571 28 0.571 28s8.571 10.857 32.571 10.857l156.571 1.143c14.857-2.286 25.143-10.286 25.143-10.286s9.143-6.286 13.714-18.286c25.714-64 58.857-122.286 58.857-122.286 57.143-117.714 96-137.714 118.286-125.714 0 0 29.143 17.714 22.857 160-2.286 51.429-16.571 74.857-16.571 74.857-13.143 17.714-37.714 22.857-48.571 24.571-8.571 1.143 5.714 21.714 24.571 30.857 28 13.714 77.714 14.286 136.571 13.714 46.286-0.571 59.429-3.429 77.143-7.429 54.286-13.143 36-63.429 36-184.571 0-38.857-7.429-93.143 20.571-110.857 12-8 41.714-1.143 114.857 123.429 0 0 34.286 59.429 61.143 128.571 4.571 12.571 14.286 17.714 14.286 17.714s9.143 5.143 21.714 3.429l164.571 1.143c49.714 6.286 57.714-16.571 57.714-16.571z" />
19
+ <glyph unicode="&#xf232;" glyph-name="whatsapp" horiz-adv-x="878" d="M562.857 394.286c9.714 0 102.857-48.571 106.857-55.429 1.143-2.857 1.143-6.286 1.143-8.571 0-14.286-4.571-30.286-9.714-43.429-13.143-32-66.286-52.571-98.857-52.571-27.429 0-84 24-108.571 35.429-81.714 37.143-132.571 100.571-181.714 173.143-21.714 32-41.143 71.429-40.571 110.857v4.571c1.143 37.714 14.857 64.571 42.286 90.286 8.571 8 17.714 12.571 29.714 12.571 6.857 0 13.714-1.714 21.143-1.714 15.429 0 18.286-4.571 24-19.429 4-9.714 33.143-87.429 33.143-93.143 0-21.714-39.429-46.286-39.429-59.429 0-2.857 1.143-5.714 2.857-8.571 12.571-26.857 36.571-57.714 58.286-78.286 26.286-25.143 54.286-41.714 86.286-57.714 4-2.286 8-4 12.571-4 17.143 0 45.714 55.429 60.571 55.429zM446.857 91.428c197.714 0 358.857 161.143 358.857 358.857s-161.143 358.857-358.857 358.857-358.857-161.143-358.857-358.857c0-75.429 24-149.143 68.571-210.286l-45.143-133.143 138.286 44c58.286-38.286 127.429-59.429 197.143-59.429zM446.857 881.143c237.714 0 430.857-193.143 430.857-430.857s-193.143-430.857-430.857-430.857c-72.571 0-144.571 18.286-208.571 53.714l-238.286-76.571 77.714 231.429c-40.571 66.857-61.714 144-61.714 222.286 0 237.714 193.143 430.857 430.857 430.857z" />
20
+ <glyph unicode="&#xf281;" glyph-name="reddit-alien" d="M1024 467.428c0-44.571-25.143-82.857-62.286-101.714 4.571-17.714 6.857-36 6.857-54.857 0-180.571-204-326.857-455.429-326.857-250.857 0-454.857 146.286-454.857 326.857 0 18.286 2.286 36.571 6.286 53.714-38.286 18.857-64.571 57.714-64.571 102.857 0 62.857 50.857 113.714 113.714 113.714 32.571 0 61.714-13.714 82.857-36 77.143 53.714 180 88.571 294.286 92.571l66.286 297.714c2.286 10.286 13.143 17.143 23.429 14.857l210.857-46.286c13.714 27.429 42.857 46.857 76 46.857 47.429 0 85.714-38.286 85.714-85.143 0-47.429-38.286-85.714-85.714-85.714-46.857 0-85.143 38.286-85.143 85.143l-190.857 42.286-59.429-269.714c114.857-3.429 218.857-37.714 296.571-91.429 20.571 21.714 49.714 34.857 81.714 34.857 62.857 0 113.714-50.857 113.714-113.714zM238.857 353.714c0-47.429 38.286-85.714 85.143-85.714 47.429 0 85.714 38.286 85.714 85.714 0 46.857-38.286 85.143-85.714 85.143-46.857 0-85.143-38.286-85.143-85.143zM701.714 150.857c8.571 8.571 8.571 21.143 0 29.714-8 8-21.143 8-29.143 0-34.286-34.857-108-46.857-160.571-46.857s-126.286 12-160.571 46.857c-8 8-21.143 8-29.143 0-8.571-8-8.571-21.143 0-29.714 54.286-54.286 158.857-58.286 189.714-58.286s135.429 4 189.714 58.286zM700 268c46.857 0 85.143 38.286 85.143 85.714 0 46.857-38.286 85.143-85.143 85.143-47.429 0-85.714-38.286-85.714-85.143 0-47.429 38.286-85.714 85.714-85.714z" />
21
+ <glyph unicode="&#xf2ac;" glyph-name="snapchat-ghost" horiz-adv-x="951" d="M484.571 877.714c102.857 1.143 188-56.571 230.857-149.143 13.143-28 15.429-71.429 15.429-102.286 0-36.571-2.857-72.571-5.143-109.143 4.571-2.286 10.857-4 16-4 20.571 0 37.714 15.429 58.286 15.429 19.429 0 47.429-13.714 47.429-36.571 0-54.857-114.857-44.571-114.857-92.571 0-8.571 3.429-16.571 6.857-24.571 27.429-60 79.429-117.714 141.143-143.429 14.857-6.286 29.714-9.714 45.714-13.143 10.286-2.286 16-9.714 16-20 0-38.857-98.857-54.857-125.143-58.857-11.429-17.714-2.857-59.429-33.143-59.429-23.429 0-46.857 7.429-72 7.429-12 0-24-0.571-35.429-2.857-68-11.429-90.857-84.571-202.286-84.571-107.429 0-133.143 73.143-199.429 84.571-12 2.286-24 2.857-36 2.857-25.714 0-50.286-8.571-70.857-8.571-32 0-22.286 42.286-34.286 60.571-26.286 4-125.143 20-125.143 58.857 0 10.286 5.714 17.714 16 20 16 3.429 30.857 6.857 45.714 13.143 61.143 25.143 114.286 83.429 141.143 143.429 3.429 8 6.857 16 6.857 24.571 0 48-115.429 38.857-115.429 92 0 22.286 26.286 36.571 46.286 36.571 17.714 0 35.429-14.857 57.714-14.857 6.286 0 12.571 1.143 18.286 4-2.286 36-5.143 72-5.143 108.571 0 30.857 2.286 74.857 15.429 102.857 50.286 108.571 135.429 148 249.143 149.143z" />
22
+ </font></defs></svg>
components/social-icons/fonts/icomoon.ttf ADDED
Binary file
components/social-icons/fonts/icomoon.woff ADDED
Binary file
components/social-icons/social-icons.php ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function ampforwp_framework_get_social_icons($selected_social_icons){
3
+
4
+ /* TODO:
5
+ 1: Connect with options panel
6
+ 2: Add icons for email, line and whatsapp
7
+ */
8
+ global $post;
9
+ $post_id = $post->ID;
10
+ $desc = $post->post_excerpt;
11
+ if (has_post_thumbnail( $post_id ) ){
12
+ $thumb_id = get_post_thumbnail_id($post_id);
13
+ $image = wp_get_attachment_image_src( $thumb_id, 'full' );
14
+ }
15
+ $social_icons_names = array();
16
+ $url = get_the_permalink();
17
+ $title = get_the_title();
18
+
19
+ foreach ($selected_social_icons as $key => $value) {
20
+ $social_icons_names[] = $key;
21
+ }
22
+ if($selected_social_icons['twitter'] == null){
23
+ $selected_social_icons['twitter'] = 'https://twitter.com/intent/tweet?url='. $url.'&text='. $title .' ';
24
+ //https://twitter.com/intent/tweet?url={url}&text={title}&via={via}&hashtags={hashtags}
25
+ }
26
+ if($selected_social_icons['facebook'] == null){
27
+ $selected_social_icons['facebook'] = 'https://www.facebook.com/sharer.php?u='. $url. '';
28
+ //or https://www.facebook.com/dialog/share?app_id={app_id}&display=page&href={url}&redirect_uri={redirect_url}
29
+ }
30
+ if($selected_social_icons['pinterest'] == null){
31
+ $selected_social_icons['pinterest'] = 'https://pinterest.com/pin/create/bookmarklet/?media='.$image.' &url='. $url.'&description='. $title .'';
32
+ //https://pinterest.com/pin/create/bookmarklet/?media={img}&url={url}&is_video={is_video}&description={title}
33
+ }
34
+ if($selected_social_icons['google-plus'] == null){
35
+ $selected_social_icons['google-plus'] = 'https://plus.google.com/share?url='. $url. '';
36
+ //https://plus.google.com/share?url={url}
37
+ }
38
+ if($selected_social_icons['linkedin'] == null){
39
+ $selected_social_icons['linkedin'] = 'https://www.linkedin.com/shareArticle?url='. $url. '&title='. $title .'';
40
+ //https://www.linkedin.com/shareArticle?url={url}&title={title}
41
+ }
42
+
43
+ if($selected_social_icons['reddit'] == null){
44
+ $selected_social_icons['reddit'] = 'https://reddit.com/submit?url='. $url. '&title='. $title .'';
45
+ //https://reddit.com/submit?url={url}&title={title}
46
+ }
47
+ if($selected_social_icons['VKontakte'] == null){
48
+ $selected_social_icons['VKontakte'] = 'http://vk.com/share.php?url='. $url. '';
49
+ //http://vk.com/share.php?url={url}
50
+ }
51
+
52
+ if($selected_social_icons['tumblr'] == null){
53
+ $selected_social_icons['tumblr'] = 'https://www.tumblr.com/widgets/share/tool?canonicalUrl='. $url. '&title='. $title .'&caption='.$desc.'';
54
+ //https://www.tumblr.com/widgets/share/tool?canonicalUrl={url}&title={title}&caption={desc}
55
+ }
56
+
57
+ ?>
58
+ <div class="amp-social">
59
+ <ul>
60
+ <?php if( in_array( 'twitter' , $selected_social_icons,true) || in_array('twitter', $social_icons_names,true) ) { ?>
61
+ <a href="<?php echo $selected_social_icons['twitter'] ?>" target ="_blank"><li class="icon-twitter"></li></a>
62
+ <?php } ?>
63
+
64
+ <?php if( in_array('facebook', $selected_social_icons,true) || in_array('facebook', $social_icons_names,true)) { ?>
65
+ <a href="<?php echo $selected_social_icons['facebook'] ?>" target ="_blank"><li class="icon-facebook"></li></a>
66
+ <?php } ?>
67
+
68
+ <?php if( in_array( 'pinterest' , $selected_social_icons,true ) || in_array( 'pinterest', $social_icons_names,true ) ) { ?>
69
+ <a href="<?php echo $selected_social_icons['pinterest'] ?>" target ="_blank"><li class="icon-pinterest"></li></a>
70
+ <?php } ?>
71
+
72
+ <?php if( in_array( 'google-plus' , $selected_social_icons,true ) || in_array( 'google-plus' , $social_icons_names,true ) ) { ?>
73
+ <a href="<?php echo $selected_social_icons['google-plus'] ?>" target ="_blank"><li class="icon-google-plus"></li></a>
74
+ <?php } ?>
75
+
76
+ <?php if( in_array( 'linkedin' , $selected_social_icons,true ) || in_array( 'linkedin' , $social_icons_names,true ) ) { ?>
77
+ <a href="<?php echo $selected_social_icons['linkedin'] ?>" target ="_blank"><li class="icon-linkedin"></li></a>
78
+ <?php } ?>
79
+
80
+ <?php if( in_array( 'youtube' , $selected_social_icons,true ) || in_array( 'youtube' , $social_icons_names,true ) ) { ?>
81
+ <a href="<?php echo $selected_social_icons['youtube'] ?>" target ="_blank"><li class="icon-youtube-play"></li></a>
82
+ <?php } ?>
83
+
84
+ <?php if( in_array( 'instagram' , $selected_social_icons,true ) || in_array( 'instagram' , $social_icons_names,true ) ) { ?>
85
+ <a href="<?php echo $selected_social_icons['instagram'] ?>" target ="_blank"> <li class="icon-instagram"></li></a>
86
+ <?php } ?>
87
+
88
+ <?php if( in_array( 'reddit' , $selected_social_icons,true ) || in_array( 'reddit' , $social_icons_names,true ) ) { ?>
89
+ <a href="<?php echo $selected_social_icons['reddit'] ?>" target ="_blank"><li class="icon-reddit-alien"></li></a>
90
+ <?php } ?>
91
+
92
+ <?php if( in_array( 'VKontakte' , $selected_social_icons,true ) || in_array( 'VKontakte' , $social_icons_names,true ) ) { ?>
93
+ <a href="<?php echo $selected_social_icons['VKontakte'] ?>" target ="_blank"><li class="icon-vk"></li></a>
94
+ <?php } ?>
95
+
96
+ <?php if( in_array( 'snapchat' , $selected_social_icons,true ) || in_array( 'snapchat' , $social_icons_names,true ) ) { ?>
97
+ <a href="<?php echo $selected_social_icons['snapchat'] ?>" target ="_blank"><li class="icon-snapchat-ghost"></li></a>
98
+ <?php } ?>
99
+
100
+ <?php if( in_array( 'tumblr' , $selected_social_icons,true ) || in_array( 'tumblr' , $social_icons_names,true ) ) { ?>
101
+ <a href="<?php echo $selected_social_icons['tumblr'] ?>" target ="_blank"><li class="icon-tumblr"></li></a>
102
+ <?php } ?>
103
+ </ul>
104
+ </div>
105
+ <?php
106
+ }
107
+ //Load styling for social icons
108
+ add_action('amp_post_template_css','amp_social_styles',11);
109
+ function amp_social_styles(){ ?>
110
+
111
+ /* Social icons */
112
+ @font-face {
113
+ font-family: 'icomoon';
114
+ src: url('<?php echo plugin_dir_url(__FILE__) ?>fonts/icomoon.eot?b9qrme');
115
+ src: url('<?php echo plugin_dir_url(__FILE__) ?>fonts/icomoon.eot?b9qrme#iefix') format('embedded-opentype'),
116
+ url('<?php echo plugin_dir_url(__FILE__) ?>fonts/icomoon.ttf?b9qrme') format('truetype'),
117
+ url('<?php echo plugin_dir_url(__FILE__) ?>fonts/icomoon.woff?b9qrme') format('woff'),
118
+ url('<?php echo plugin_dir_url(__FILE__) ?>fonts/icomoon.svg?b9qrme#icomoon') format('svg');
119
+ font-weight: normal;
120
+ font-style: normal;
121
+ }
122
+
123
+ [class^="icon-"], [class*=" icon-"]{ font-family: 'icomoon'; speak: none; font-style: normal; font-weight: normal; font-variant: normal; text-transform: none; line-height: 1;
124
+
125
+ /* Better Font Rendering =========== */
126
+ -webkit-font-smoothing: antialiased;
127
+ -moz-osx-font-smoothing: grayscale;
128
+ }
129
+
130
+ .icon-twitter:before{ content: "\f099";background:#1da1f2 }
131
+ .icon-facebook:before{ content: "\f09a";background:#3b5998 }
132
+ .icon-facebook-f:before{ content: "\f09a";background:#3b5998 }
133
+ .icon-pinterest:before{ content: "\f0d2";background:#bd081c }
134
+ .icon-google-plus:before{ content: "\f0d5";background:#dd4b39 }
135
+ .icon-linkedin:before{ content: "\f0e1";background:#0077b5 }
136
+ .icon-youtube-play:before{ content: "\f16a";background:#cd201f }
137
+ .icon-instagram:before{ content: "\f16d";background:#c13584 }
138
+ .icon-tumblr:before{ content: "\f173";background:#35465c }
139
+ .icon-vk:before{ content: "\f189";background:#45668e }
140
+ .icon-whatsapp:before{ content: "\f232";background:#075e54 }
141
+ .icon-reddit-alien:before{ content: "\f281";background:#ff4500 }
142
+ .icon-snapchat-ghost:before{ content: "\f2ac"; background:#fffc00 }
143
+ .amp-social{ font-size: 15px; display: inline-block; }
144
+ .amp-social ul{ list-style-type:none; padding:0;margin:0; text-align:center }
145
+ .amp-social li{ box-sizing: initial; display:inline-block; }
146
+ .amp-social li:before{ box-sizing: initial; color:#fff; padding: 6px; display: inline-block; border-radius: 70px; width: 18px; height: 18px; line-height: 20px; text-align: center; }
147
+
148
+ <?php }
components/theme-loader.php ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if(!defined('AMPFORWP_CUSTOM_THEME')){
3
+ define('AMPFORWP_CUSTOM_THEME',AMPFORWP_MAIN_PLUGIN_DIR."/".$ampforwp_design_selector);
4
+ }
5
+
6
+
7
+ require_once( AMPFORWP_CUSTOM_THEME . '/functions.php' );
8
+ //Filter the Template files to override previous ones
9
+ add_filter( 'amp_post_template_file', 'ampforwp_custom_header_file', 10, 2 );
10
+ add_filter( 'amp_post_template_file', 'ampforwp_designing_custom_template', 10, 3 );
11
+ add_filter( 'amp_post_template_file', 'ampforwp_custom_footer_file', 10, 2 );
12
+
13
+ // Custom Header
14
+ function ampforwp_custom_header_file( $file, $type ) {
15
+ if ( 'header' === $type ) {
16
+ $file = AMPFORWP_CUSTOM_THEME . '/header.php';
17
+ }
18
+ return $file;
19
+ }
20
+
21
+ // Custom Template Files
22
+ function ampforwp_designing_custom_template( $file, $type, $post ) {
23
+ global $redux_builder_amp;
24
+ // Single file
25
+ if ( is_single() || is_page() ) {
26
+ if('single' === $type && !('product' === $post->post_type )) {
27
+ $file = AMPFORWP_CUSTOM_THEME . '/single.php';
28
+ }
29
+ }
30
+ // Loop Template
31
+ if ( 'loop' === $type ) {
32
+ $file = AMPFORWP_CUSTOM_THEME . '/loop.php';
33
+ }
34
+ // Archive
35
+ if ( is_archive() ) {
36
+ if ( 'single' === $type ) {
37
+ $file = AMPFORWP_CUSTOM_THEME . '/archive.php';
38
+ }
39
+ }
40
+ $ampforwp_custom_post_page = ampforwp_custom_post_page();
41
+ // Homepage
42
+ if ( is_home() ) {
43
+ if ( 'single' === $type ) {
44
+ $file = AMPFORWP_CUSTOM_THEME . '/index.php';
45
+
46
+ if ($redux_builder_amp['amp-frontpage-select-option'] == 1) {
47
+ $file = AMPFORWP_CUSTOM_THEME . '/page.php';
48
+ }
49
+ if ( $ampforwp_custom_post_page == "page" && ampforwp_name_blog_page() ) {
50
+ $current_url = home_url( $GLOBALS['wp']->request );
51
+ $current_url_in_pieces = explode( '/', $current_url );
52
+
53
+ if( in_array( ampforwp_name_blog_page() , $current_url_in_pieces ) ) {
54
+ $file = AMPFORWP_CUSTOM_THEME . '/index.php';
55
+ }
56
+ }
57
+ }
58
+ }
59
+ // is_search
60
+ if ( is_search() ) {
61
+ if ( 'single' === $type ) {
62
+ $file = AMPFORWP_CUSTOM_THEME . '/search.php';
63
+ }
64
+ }
65
+
66
+ return $file;
67
+ }
68
+
69
+ // Custom Footer
70
+ function ampforwp_custom_footer_file($file, $type ){
71
+ if ( 'footer' === $type ) {
72
+ $file = AMPFORWP_CUSTOM_THEME . '/footer.php';
73
+ }
74
+ return $file;
75
+ }
76
+ // Load the Core Styles of Custom Theme
77
+ add_action('amp_css', 'ampforwp_custom_style');
78
+ function ampforwp_custom_style() {
79
+ global $redux_builder_amp;
80
+ require_once( AMPFORWP_CUSTOM_THEME . '/style.php' );
81
+ // Custom CSS
82
+ echo $redux_builder_amp['css_editor'];
83
+ }
84
+
85
+ // Loading Custom Google Fonts in the theme
86
+ /*add_action( 'amp_post_template_head', 'amp_post_template_add_custom_google_font');
87
+ function amp_post_template_add_custom_google_font( $amp_template ) {
88
+ $font_urls = $amp_template->get( 'font_urls', array() );
89
+ $font_urls['source_serif_pro'] = 'https://fonts.googleapis.com/css?family=Source+Serif+Pro:400,600|Source+Sans+Pro:400,700'; ?>
90
+ <link rel="stylesheet" href="<?php echo esc_url( $font_urls['source_serif_pro'] ); ?>">
91
+ <?php }*/
92
+
93
+
includes/options/admin-config.php CHANGED
@@ -1,10 +1,11 @@
1
  <?php
2
- // Admin Panel Options
3
  if ( ! class_exists( 'Redux' ) ) {
4
  return;
5
  }
6
  // Option name where all the Redux data is stored.
7
  $opt_name = "redux_builder_amp";
 
8
  $comment_AD_URL = "http://ampforwp.com/amp-comments/#utm_source=options-panel&utm_medium=comments-tab&utm_campaign=AMP%20Plugin";
9
  $cta_AD_URL = "http://ampforwp.com/call-to-action/#utm_source=options-panel&utm_medium=call-to-action_banner_in_notification_bar&utm_campaign=AMP%20Plugin";
10
  $comment_desc = '<a href="'.$comment_AD_URL.'" target="_blank"><img class="ampforwp-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/comments-banner.png" width="560" height="85" /></a>';
@@ -88,12 +89,12 @@ $extension_listing = '
88
  <div class="extension_btn">From: $19</div>
89
  </div>
90
  </a></li>
91
- <li class="first"><a href="https://wordpress.org/plugins/amp-woocommerce/" target="_blank">
92
  <div class="align_left"><img src="'.AMPFORWP_IMAGE_DIR . '/woo.png" /></div>
93
  <div class="extension_desc">
94
- <h2>AMP WooCommerce</h2>
95
- <p>Add WooCommerce in AMP in two clicks.</p>
96
- <div class="extension_btn">FREE</div>
97
  </div>
98
  </a></li>
99
 
@@ -182,12 +183,12 @@ $gettingstarted_extension_listing = '
182
  <div class="extension_btn">From: $19</div>
183
  </div>
184
  </a></li>
185
- <li class="second"><a href="https://wordpress.org/plugins/amp-woocommerce/" target="_blank">
186
  <div class="align_left"><img src="'.AMPFORWP_IMAGE_DIR . '/woo.png" /></div>
187
  <div class="extension_desc">
188
- <h2>AMP WooCommerce</h2>
189
- <p>Add WooCommerce in AMP in two clicks.</p>
190
- <div class="extension_btn">FREE</div>
191
  </div>
192
  </a></li>
193
 
@@ -372,7 +373,7 @@ Redux::setArgs( "redux_builder_amp", $args );
372
  ) );
373
 
374
  Redux::setSection( $opt_name, array(
375
- 'title' => __( 'Getting Started', 'accelerated-mobile-pages' ),
376
  'id' => 'basic',
377
  'desc' => __( '<div class="amp-faq">Thank you for using Accelerated Mobile Pages plugin. '. ' ' .
378
 
@@ -396,7 +397,7 @@ Redux::setArgs( "redux_builder_amp", $args );
396
  ' .$gettingstarted_extension_listing
397
 
398
  , 'accelerated-mobile-pages' ),
399
- 'icon' => 'el el-home'
400
  ) );
401
 
402
  Redux::setSection( $opt_name, array(
@@ -414,13 +415,13 @@ Redux::setArgs( "redux_builder_amp", $args );
414
  'subtitle' => __('Upload a logo for the AMP version.', 'accelerated-mobile-pages'),
415
  'desc' => __('Recommend logo size is: 190x36', 'accelerated-mobile-pages')
416
  ),
417
- array(
418
  'id' => 'ampforwp-custom-logo-dimensions',
419
  'title' => __('Custom Logo Size', 'accelerated-mobile-pages'),
420
  'type' => 'switch',
421
  'default' => 0,
422
  ),
423
- array(
424
  'id' => 'opt-media-width',
425
  'type' => 'text',
426
  'title' => __('Logo Width', 'accelerated-mobile-pages'),
@@ -428,7 +429,7 @@ Redux::setArgs( "redux_builder_amp", $args );
428
  'default' => '190',
429
  'required'=>array('ampforwp-custom-logo-dimensions','=','1'),
430
  ),
431
- array(
432
  'id' => 'opt-media-height',
433
  'type' => 'text',
434
  'title' => __('Logo Height', 'accelerated-mobile-pages'),
@@ -437,6 +438,12 @@ Redux::setArgs( "redux_builder_amp", $args );
437
  'required'=>array('ampforwp-custom-logo-dimensions','=','1'),
438
 
439
  ),
 
 
 
 
 
 
440
  array(
441
  'id' =>'amp-on-off-for-all-pages',
442
  'type' => 'switch',
@@ -445,37 +452,14 @@ Redux::setArgs( "redux_builder_amp", $args );
445
  'default' => 1,
446
  'desc' => __( 'Re-Save permalink if you make changes in this option, please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages' ),
447
  ),
448
-
449
-
450
- // array(
451
- // 'id' => 'amp-ad-places',
452
- // 'type' => 'select',
453
- // 'title' => __( 'Ads on Page', 'accelerated-mobile-pages' ),
454
- // 'subtitle' => __( 'select your preferece for Ads on Post Types', 'accelerated-mobile-pages' ),
455
- // 'options' => array(
456
- // '1' => __('Only on Posts', 'accelerated-mobile-pages' ),
457
- // '2' => __('Only on Pages', 'accelerated-mobile-pages' ),
458
- // '3' => __('on Both', 'accelerated-mobile-pages' ),
459
- // ),
460
- // 'default' => '3'
461
- // ),
462
-
463
- )
464
- ) );//END
465
- // Homepage Section
466
- Redux::setSection( $opt_name, array(
467
- 'title' => __( 'Homepage', 'accelerated-mobile-pages' ),
468
- 'id' => 'amp-homepage-settings',
469
- 'subsection' => true,
470
- 'fields' => array(
471
- array(
472
- 'id' => 'ampforwp-homepage-on-off-support',
473
- 'type' => 'switch',
474
- 'title' => __('Homepage Support', 'accelerated-mobile-pages'),
475
- 'subtitle' => __('Enable/Disable Home page using this switch.', 'accelerated-mobile-pages'),
476
- 'default' => '1'
477
  ),
478
- array(
479
  'id' =>'amp-frontpage-select-option',
480
  'type' => 'switch',
481
  'title' => __('Front Page', 'accelerated-mobile-pages'),
@@ -486,7 +470,7 @@ Redux::setArgs( "redux_builder_amp", $args );
486
  'required' => array('ampforwp-homepage-on-off-support','=','1'),
487
  'desc' => __( 'Re-Save permalink if front page or custom post page\'s pagination is not working. Please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages' ),
488
  ),
489
- array(
490
  'id' => 'amp-frontpage-select-option-pages',
491
  'type' => 'select',
492
  'title' => __('Select Page as Front Page', 'accelerated-mobile-pages'),
@@ -499,7 +483,7 @@ Redux::setArgs( "redux_builder_amp", $args );
499
  ),
500
  'default' => '2',
501
  ),
502
- array(
503
  'id' => 'ampforwp-title-on-front-page',
504
  'type' => 'switch',
505
  'url' => true,
@@ -508,69 +492,29 @@ Redux::setArgs( "redux_builder_amp", $args );
508
  'default' => 0,
509
  'required' => array('amp-frontpage-select-option', '=' , '1'),
510
  ),
511
- array(
512
- 'id' => 'ampforwp-homepage-posts-image-modify-size',
513
- 'type' => 'switch',
514
- 'title' => __('Override Homepage Thumbnail Size', 'accelerated-mobile-pages'),
515
- 'default' => 0,
516
- 'required' => array(
517
- array('amp-design-selector','!=',3)
518
- )
519
- ),
520
- array(
521
- 'id' => 'ampforwp-homepage-posts-design-1-2-width',
522
- 'type' => 'text',
523
- 'title' => __('Image Width', 'accelerated-mobile-pages'),
524
- 'subtitle' => __('Defaults to 100', 'accelerated-mobile-pages'),
525
- 'default' => 100,
526
- 'required' => array(
527
- array('amp-design-selector','!=',3),
528
- array('ampforwp-homepage-posts-image-modify-size','=',1)
529
- )
530
- ),
531
- array(
532
- 'id' => 'ampforwp-homepage-posts-design-1-2-height',
533
- 'type' => 'text',
534
- 'title' => __('Image Height', 'accelerated-mobile-pages'),
535
- 'subtitle' => __('Defaults to 75', 'accelerated-mobile-pages'),
536
- 'default' => 75,
537
- 'required' => array(
538
- array('amp-design-selector','!=',3),
539
- array('ampforwp-homepage-posts-image-modify-size','=',1)
540
- )
541
- ),
542
- array(
543
- 'id' => 'ampforwp-homepage-posts-design-3-width',
544
- 'type' => 'text',
545
- 'title' => __('Image Width', 'accelerated-mobile-pages'),
546
- 'subtitle' => __('Defaults to 450', 'accelerated-mobile-pages'),
547
- 'default' => 330,
548
- 'required' => array(
549
- array('amp-design-selector','=',3),
550
- array('ampforwp-homepage-posts-image-modify-size','=',1)
551
- )
552
- ),
553
  array(
554
- 'id' => 'ampforwp-homepage-posts-design-3-height',
555
- 'type' => 'text',
556
- 'title' => __('Image Height', 'accelerated-mobile-pages'),
557
- 'subtitle' => __('Defaults to 270', 'accelerated-mobile-pages'),
558
- 'default' => 198,
559
- 'required' => array(
560
- array('amp-design-selector','=',3),
561
- array('ampforwp-homepage-posts-image-modify-size','=',1)
562
- )
563
- ),
564
- array(
565
- 'id' =>'amp-on-off-support-for-non-amp-home-page',
566
- 'type' => 'switch',
567
- 'title' => __('Non-AMP HomePage link in Header and Logo', 'accelerated-mobile-pages'),
568
- 'subtitle' => __('If you want users in header to go to non-AMP website from the Header, then you can enable this option', 'accelerated-mobile-pages'),
569
- 'default' => 0,
570
- )
571
- )
572
- )
573
- );
 
 
574
 
575
  // AMP Content Page Builder SECTION
576
  Redux::setSection( $opt_name, array(
@@ -601,426 +545,66 @@ Redux::setArgs( "redux_builder_amp", $args );
601
 
602
  ) ;
603
 
 
 
 
 
604
 
605
-
606
- //code for fetching ctegories to show as a list in redux settings
607
- $categories = get_categories( array(
608
- 'orderby' => 'name',
609
- 'order' => 'ASC'
610
- ) );
611
- $categories_array = array();
612
- if ( $categories ) :
613
- foreach ($categories as $cat ) {
614
- $cat_id = $cat->cat_ID;
615
- $key = "".$cat_id;
616
- //building assosiative array of ID-cat_name
617
- $categories_array[ $key ] = $cat->name;
618
- }
619
- endif;
620
- //End of code for fetching ctegories to show as a list in redux settings
621
-
622
- function ampforwp_get_element_default_color() {
623
- $default_value = get_option('redux_builder_amp', true);
624
- $default_value = $default_value['amp-opt-color-rgba-colorscheme']['color'];
625
- if ( empty( $default_value ) ) {
626
- $default_value = '#333';
627
  }
628
- return $default_value;
629
- }
630
-
631
- // AMP Design SECTION
632
- Redux::setSection( $opt_name, array(
633
- 'title' => __( 'Design', 'accelerated-mobile-pages' ),
634
- 'desc' => '
635
- <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
636
- 'id' => 'amp-design',
637
- 'subsection' => true,
638
- 'fields' => array(
639
-
640
- $fields = array(
641
- 'id' => 'amp-design-selector',
642
- 'type' => 'select',
643
- 'title' => __( 'Design Selector', 'accelerated-mobile-pages' ),
644
- 'subtitle' => __( 'Select your design.', 'accelerated-mobile-pages' ),
645
- 'desc' => '<a href="https://ampforwp.com/themes/" target="_blank">View More AMP Themes →</a>',
646
- 'options' => array(
647
- '1' => __('Design One', 'accelerated-mobile-pages' ),
648
- '2' => __('Design Two', 'accelerated-mobile-pages' ),
649
- '3' => __('Design Three', 'accelerated-mobile-pages' )
650
- ),
651
- 'default' => '2'
652
- ),
653
-
654
- array(
655
- 'id' => 'amp-opt-sticky-head',
656
- 'type' => 'switch',
657
- 'title' => __('Make Header UnSticky','accelerated-mobile-pages'),
658
- 'required' => array(
659
- array('amp-design-selector', '=' , '3')
660
- ),
661
- 'desc' => __('Turning it ON will remove the sticky head from the design.', 'accelerated-mobile-pages' ),
662
- 'default' => '0'
663
- ),
664
 
665
- array(
666
- 'id' => 'amp-opt-color-rgba-colorscheme',
667
- 'type' => 'color_rgba',
668
- 'title' => __('Color Scheme','accelerated-mobile-pages'),
669
- 'default' => array(
670
- 'color' => '#F42F42',
671
- ),
672
- 'required' => array(
673
- array('amp-design-selector', '=' , '3')
674
- )
675
- ),
676
- array(
677
- 'id' => 'amp-opt-color-rgba-headercolor',
678
- 'type' => 'color_rgba',
679
- 'title' => __('Header Background Color','accelerated-mobile-pages'),
680
- 'default' => array(
681
- 'color' => '#FFFFFF',
682
  ),
683
- 'required' => array(
684
- array('amp-design-selector', '=' , '3')
685
- )
686
- ),
687
- array(
688
- 'id' => 'amp-opt-color-rgba-font',
689
- 'type' => 'color_rgba',
690
- 'title' => __('Color Scheme Font Color','accelerated-mobile-pages'),
691
- 'default' => array(
692
- 'color' => '#fff',
 
 
 
 
 
693
  ),
694
- 'required' => array(
695
- array('amp-design-selector', '=' , '3')
696
- )
697
- ),
698
-
699
- array(
700
- 'id' => 'amp-opt-color-rgba-link',
701
- 'type' => 'color_rgba',
702
- 'title' => __('Anchor Link Color','accelerated-mobile-pages'),
703
- 'default' => array(
704
- 'color' => '#f42f42',
705
- ),
706
- 'required' => array(
707
- array('amp-design-selector', '=' , '3')
708
- )
709
- ),
710
-
711
-
712
- array(
713
- 'id' => 'amp-opt-color-rgba-headerelements',
714
- 'type' => 'color_rgba',
715
- 'title' => __('Header Elements Color','accelerated-mobile-pages'),
716
- 'default' => array(
717
- 'color' => ampforwp_get_element_default_color(),
718
  ),
719
- 'required' => array(
720
- array('amp-design-selector', '=' , '3')
721
- )
722
- ),
723
-
724
-
725
- array(
726
- 'id' => 'amp-design-3-featured-slider',
727
- 'type' => 'switch',
728
- 'title' => __( 'Featured Slider', 'accelerated-mobile-pages' ),
729
- 'required' => array(
730
- array('amp-design-selector', '=' , '3')
731
- ),
732
- 'default' => '1'
733
- ),
734
- array(
735
- 'id' => 'amp-design-3-category-selector',
736
- 'type' => 'select',
737
- 'title' => __( 'Featured Slider Category', 'accelerated-mobile-pages' ),
738
- 'options' => $categories_array,
739
- 'required' => array(
740
- array('amp-design-selector', '=' , '3'),
741
- array('amp-design-3-featured-slider', '=' , '1')
742
- ),
743
- ),
744
- array(
745
- 'id' => 'amp-design-3-search-feature',
746
- 'type' => 'switch',
747
- 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
748
- 'title' => __( 'Search', 'accelerated-mobile-pages' ),
749
- 'required' => array(
750
- array('amp-design-selector', '=' , '3')
751
- ),
752
- 'default' => '0'
753
- ),
754
-
755
-
756
- array(
757
- 'id' => 'amp-design-2-search-feature',
758
- 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
759
- 'type' => 'switch',
760
- 'title' => __( 'Search', 'accelerated-mobile-pages' ),
761
- 'required' => array(
762
- array('amp-design-selector', '=' , '2')
763
- ),
764
- 'default' => '0'
765
- ),
766
-
767
- array(
768
- 'id' => 'amp-design-1-search-feature',
769
- 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
770
- 'type' => 'switch',
771
- 'title' => __( 'Search', 'accelerated-mobile-pages' ),
772
- 'required' => array(
773
- array('amp-design-selector', '=' , '1')
774
- ),
775
- 'default' => '0'
776
- ),
777
- // Excerpt Length #1013
778
- array(
779
- 'id' =>'amp-design-1-excerpt',
780
- 'type' =>'text',
781
- 'subtitle' =>__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
782
- 'title' =>__('Excerpt Length','accelerated-mobile-pages'),
783
- 'required' => array(
784
- array('amp-design-selector', '=' , '1')
785
- ),
786
- 'validate' =>'numeric',
787
- 'default' =>'20',
788
- ),
789
- // Call Now button
790
- array(
791
- 'id' => 'ampforwp-callnow-button',
792
- 'type' => 'switch',
793
- 'title' => __('Call Now Button', 'accelerated-mobile-pages'),
794
- 'true' => 'true',
795
- 'false' => 'false',
796
- 'default' => 0
797
- ),
798
- array(
799
- 'id' =>'enable-amp-call-numberfield',
800
- 'type' => 'text',
801
- 'required' => array('ampforwp-callnow-button', '=' , '1'),
802
- 'title' => __('Enter Phone Number', 'accelerated-mobile-pages'),
803
- 'default' => '',
804
- ),
805
- array(
806
- 'id' => 'amp-opt-color-rgba-colorscheme-call',
807
- 'type' => 'color_rgba',
808
- 'title' => __('Call Button Color','accelerated-mobile-pages'),
809
- 'default' => array(
810
- 'color' => '#0a89c0',
811
- ),
812
- 'required' => array(
813
- array('ampforwp-callnow-button', '=' , '1')
814
- )
815
- ),
816
-
817
- array(
818
- 'id' => 'amp-design-3-credit-link',
819
- 'type' => 'switch',
820
- 'title' => __( 'Credit link', 'accelerated-mobile-pages' ),
821
- 'required' => array(
822
- array('amp-design-selector', '=' , '3')
823
- ),
824
- 'default' => '1'
825
- ),
826
-
827
- array(
828
- 'id' => 'css_editor',
829
- 'type' => 'ace_editor',
830
- 'title' => __('Custom CSS', 'accelerated-mobile-pages'),
831
- 'subtitle' => __('You can customize the Stylesheet of the AMP version by using this option.', 'accelerated-mobile-pages'),
832
- 'mode' => 'css',
833
- 'theme' => 'monokai',
834
- 'desc' => '',
835
- 'default' => __('/******* Paste your Custom CSS in this Editor *******/','accelerated-mobile-pages')
836
- ),
837
- )
838
-
839
- )
840
-
841
- );
842
-
843
- // Single Section
844
- Redux::setSection( $opt_name, array(
845
- 'title' => __( 'Single', 'accelerated-mobile-pages' ),
846
- // 'desc' => __( 'Additional Options to control the look of Single <a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'"> Click here </a> ', 'accelerated-mobile-pages' ),
847
- 'id' => 'amp-single',
848
- 'subsection' => true,
849
- 'fields' => array(
850
- // Social Icons ON/OFF
851
- array(
852
- 'id' => 'enable-single-social-icons',
853
- 'type' => 'switch',
854
- 'title' => __('Sticky Social Icons', 'accelerated-mobile-pages'),
855
- 'default' => 1,
856
- 'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
857
- ),
858
- // Excerpt ON/OFF
859
- array(
860
- 'id' => 'enable-excerpt-single',
861
- 'type' => 'switch',
862
- 'title' => __('Excerpt in single', 'accelerated-mobile-pages'),
863
- 'default' => 0,
864
- 'subtitle' => __('Enable feature to add Excerpt above Content in single', 'accelerated-mobile-pages'),
865
- ),
866
- //deselectable next previous links
867
- array(
868
- 'id' => 'enable-single-next-prev',
869
- 'type' => 'switch',
870
- 'title' => __('Next-Previous Links', 'accelerated-mobile-pages'),
871
- 'default' => 1,
872
- 'subtitle' => __('Enable Next-Previous links in single', 'accelerated-mobile-pages'),
873
- ),
874
- // Post Modified Date
875
- array(
876
- 'id' => 'post-modified-date',
877
- 'type' => 'switch',
878
- 'title' => __('Show Post Modified Date', 'accelerated-mobile-pages'),
879
- 'default' => 0,
880
- 'subtitle' => __('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
881
- ),
882
- // Author Bio
883
- array(
884
- 'id' => 'amp-author-description',
885
- 'type' => 'switch',
886
- 'title' => __( 'Author Bio in Single', 'accelerated-mobile-pages' ),
887
- 'default' => '1',
888
- ),
889
- // Date on Single
890
- array(
891
- 'id' => 'amp-design-3-date-feature',
892
- 'type' => 'switch',
893
- 'title' => __( 'Display Date on Single', 'accelerated-mobile-pages' ),
894
- 'required' => array(
895
- array('amp-design-selector', '=' , '3')
896
- ),
897
- 'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
898
- 'default' => '0'
899
- ),
900
- // Pagination //#1015 Pegazee
901
- array(
902
- 'id' => 'amp-pagination',
903
- 'type' => 'switch',
904
- 'title' => __( 'Pagination in Single', 'accelerated-mobile-pages' ),
905
- 'default' => 0,
906
- 'subtitle' => __('Enable the feature to add Pagination in single', 'accelerated-mobile-pages'),
907
- ),
908
- // Related Post
909
- array(
910
- 'id' => 'ampforwp-single-select-type-of-related',
911
- 'type' => 'select',
912
- 'title' => __('Show Related Post from', 'accelerated-mobile-pages'),
913
- 'data' => 'page',
914
- 'subtitle' => __('select the type of related posts', 'accelerated-mobile-pages'),
915
- 'options' => array(
916
- '1' => 'Tags',
917
- '2' => 'Categories'
918
- ),
919
- 'default' => '2',
920
- ),
921
- array(
922
- 'id' => 'ampforwp-number-of-related-posts',
923
- 'type' => 'text',
924
- 'title' => __('Number of Related Post', 'accelerated-mobile-pages'),
925
- 'subtitle' => __('Type the number of related posts you need, Eg : 2', 'accelerated-mobile-pages'),
926
- 'validate' => 'numeric',
927
- 'default' => '3',
928
- ),
929
- // Pages
930
- array(
931
- 'id' => 'Page',
932
- 'type' => 'section',
933
- 'title' => __('Pages', 'accelerated-mobile-pages'),
934
- 'indent' => true,
935
- ),
936
- // Meta ON/OFF Pages
937
- array(
938
- 'id' => 'meta_page',
939
- 'type' => 'switch',
940
- 'default' => '0',
941
- 'title' => __('Meta For Pages', 'accelerated-mobile-pages'),
942
- 'subtitle' => __('Enable or disable the Meta on Pages'),
943
- ),
944
-
945
- // array(
946
- // 'id' => 'ampforwp-comments-banner',
947
- // 'type' => 'select',
948
- // 'desc' => $comment_desc,
949
- // 'title' => __(' df', 'accelerated-mobile-pages'),
950
- // 'class' => 'new-class',
951
- //
952
- // // 'desc' => ' <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
953
- // ),
954
- //
955
- $fields = array(
956
- 'id' => 'info_normal',
957
- 'type' => 'info',
958
- 'class' => 'extension_banner_bg',
959
- 'desc' => $single_extension_listing )
960
-
961
- ),
962
-
963
- ) );
964
-
965
- $AD_URL = "http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=advertisement-tab&utm_campaign=AMP%20Plugin";
966
- $desc = '';
967
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
968
- if(!is_plugin_active( 'amp-incontent-ads/amptoolkit-incontent-ads.php' ) ){
969
-
970
- $desc = '<a href="'.$AD_URL.'" target="_blank"><img class="ampforwp-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-ads-retina.png" width="560" height="85" /></a>';
971
- }
972
- // ADS SECTION
973
- Redux::setSection( $opt_name, array(
974
- 'title' => __( 'Advertisement', 'accelerated-mobile-pages' ),
975
- 'desc' => $desc,
976
- 'id' => 'amp-ads',
977
- 'subsection' => true,
978
- 'fields' => array(
979
- // Ad 1 Starts
980
- array(
981
- 'id' =>'enable-amp-ads-1',
982
- 'type' => 'switch',
983
- 'title' => __('AD #1', 'accelerated-mobile-pages'),
984
- 'default' => 0,
985
- 'subtitle' => __('Below the Header (SiteWide)', 'accelerated-mobile-pages'),
986
- 'true' => 'Enabled',
987
- 'false' => 'Disabled',
988
- ),
989
- array(
990
- 'id' => 'enable-amp-ads-select-1',
991
- 'type' => 'select',
992
- 'title' => __('AD Size', 'accelerated-mobile-pages'),
993
- 'required' => array('enable-amp-ads-1', '=' , '1'),
994
- // Must provide key => value pairs for select options
995
- 'options' => array(
996
- '1' => __('300x250','accelerated-mobile-pages'),
997
- '2' => __('336x280','accelerated-mobile-pages'),
998
- '3' => __('728x90','accelerated-mobile-pages'),
999
- '4' => __('300x600','accelerated-mobile-pages'),
1000
- '5' => __('320x100','accelerated-mobile-pages'),
1001
- '6' => __('200x50','accelerated-mobile-pages'),
1002
- '7' => __('320x50','accelerated-mobile-pages'), ),
1003
- 'default' => '2',
1004
- ),
1005
- array(
1006
- 'id' =>'enable-amp-ads-text-feild-client-1',
1007
- 'type' => 'text',
1008
- 'required' => array('enable-amp-ads-1', '=' , '1'),
1009
- 'title' => __('Data AD Client', 'accelerated-mobile-pages'),
1010
- 'subtitle' => __('Enter the Data Ad Client (data-ad-client) from the adsense ad code.', 'accelerated-mobile-pages'),
1011
- 'default' => '',
1012
- 'placeholder'=> 'ca-pub-2005XXXXXXXXX342'
1013
- ),
1014
- array(
1015
- 'id' => 'enable-amp-ads-text-feild-slot-1',
1016
- 'type' => 'text',
1017
- 'title' => __('Data AD Slot', 'accelerated-mobile-pages'),
1018
- 'subtitle' => __('Enter the Data Ad Slot (data-ad-slot) from the adsense ad code.', 'accelerated-mobile-pages'),
1019
- 'default' => '',
1020
- 'required' => array('enable-amp-ads-1', '=' , '1'),
1021
- 'placeholder'=> '70XXXXXX12'
1022
- ),
1023
- // Ad 1 ends
1024
 
1025
  // Ad 2 Starts
1026
  array(
@@ -1258,411 +842,59 @@ Redux::setArgs( "redux_builder_amp", $args );
1258
 
1259
  ),
1260
  ) );
1261
-
1262
 
 
 
 
 
 
 
1263
 
1264
- // AMP Menu SECTION
1265
- Redux::setSection( $opt_name, array(
1266
- 'title' => __( 'Menu', 'accelerated-mobile-pages' ),
1267
- 'desc' => __( 'Add Menus to your AMP pages by clicking on this <a href="'.trailingslashit(get_admin_url()).'nav-menus.php?action=locations">link</a>' , 'accelerated-mobile-pages'),
1268
- 'id' => 'amp-menus',
1269
- 'subsection' => true,
1270
- 'fields' => array(
1271
 
1272
- array(
1273
- 'id' => 'ampforwp-amp-menu',
1274
- 'type' => 'switch',
1275
- 'title' => __('Show/Hide Navigation Menu in AMP', 'accelerated-mobile-pages'),
1276
- 'subtitle' => __('The switch to Enable/Disable Menu in all AMP Pages', 'accelerated-mobile-pages'),
1277
- 'true' => 'true',
1278
- 'false' => 'false',
1279
- 'default' => 1
1280
- ),
1281
- array(
1282
- 'id' => 'ampforwp-auto-amp-menu-link',
1283
- 'type' => 'switch',
1284
- 'title' => __('Auto Add AMP in Menu URL', 'accelerated-mobile-pages'),
1285
- 'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1286
- 'true' => 'true',
1287
- 'false' => 'false',
1288
- 'default' => 0,
1289
- 'required' => array('ampforwp-amp-menu', '=' , '1')
1290
- ),
1291
- )
1292
- )
1293
 
1294
- ) ;
1295
 
1296
- // Social Section
1297
- Redux::setSection( $opt_name, array(
1298
- 'title' => __( 'Social', 'accelerated-mobile-pages' ),
1299
- 'id' => 'amp-social',
1300
- 'desc' => __('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
1301
- 'subsection' => true,
1302
- 'fields' => array(
1303
- // Facebook ON/OFF
1304
- array(
1305
- 'id' => 'enable-single-facebook-share',
1306
- 'type' => 'switch',
1307
- //'required' => array('enable-single-social-icons', '=' , '1'),
1308
- 'title' => __('Facebook', 'accelerated-mobile-pages'),
1309
- 'default' => 0,
1310
- ),
1311
- // Facebook app ID
1312
- array(
1313
- 'id' => 'amp-facebook-app-id',
1314
- 'title' => __('Facebook App ID', 'accelerated-mobile-pages'),
1315
- 'subtitle' => __('In order to use Facebook share you need to register an app ID, you can register one here: https://developers.facebook.com/apps.', 'accelerated-mobile-pages'),
1316
- 'type' => 'text',
1317
- 'required' => array('enable-single-facebook-share', '=' , '1'),
1318
- 'placeholder' => __('Enter your facebook app id','accelerated-mobile-pages'),
1319
- 'default' => ''
1320
- ),
1321
- // Twitter ON/OFF
1322
- array(
1323
- 'id' => 'enable-single-twitter-share',
1324
- 'type' => 'switch',
1325
- 'title' => __('Twitter', 'accelerated-mobile-pages'),
1326
- 'default' => 1,
1327
- ),
1328
- array(
1329
- 'id' => 'enable-single-twitter-share-handle',
1330
- 'type' => 'text',
1331
- 'title' => __('Twitter Handle', 'accelerated-mobile-pages'),
1332
- 'required' => array('enable-single-twitter-share', '=' , '1'),
1333
- 'placeholder' => __('Eg: @xyx','accelerated-mobile-pages'),
1334
- 'default' => '',
1335
- ),
1336
- // GooglePlus ON/OFF
1337
- array(
1338
- 'id' => 'enable-single-gplus-share',
1339
- 'type' => 'switch',
1340
- 'title' => __('GooglePlus', 'accelerated-mobile-pages'),
1341
- 'default' => 1,
1342
- ),
1343
- // Email ON/OFF
1344
- array(
1345
- 'id' => 'enable-single-email-share',
1346
- 'type' => 'switch',
1347
- 'title' => __('Email', 'accelerated-mobile-pages'),
1348
- 'default' => 1,
1349
- ),
1350
- // Pinterest ON/OFF
1351
- array(
1352
- 'id' => 'enable-single-pinterest-share',
1353
- 'type' => 'switch',
1354
- 'title' => __('Pinterest', 'accelerated-mobile-pages'),
1355
- 'default' => 1,
1356
- ),
1357
- // LinkedIn ON/OFF
1358
- array(
1359
- 'id' => 'enable-single-linkedin-share',
1360
- 'type' => 'switch',
1361
- 'title' => __('LinkedIn', 'accelerated-mobile-pages'),
1362
- 'default' => 1,
1363
- ),
1364
- // WhatsApp
1365
- array(
1366
- 'id' => 'enable-single-whatsapp-share',
1367
- 'type' => 'switch',
1368
- 'title' => __('WhatsApp', 'accelerated-mobile-pages'),
1369
- 'default' => 1,
1370
- ),
1371
- // LINE
1372
- array(
1373
- 'id' => 'enable-single-line-share',
1374
- 'type' => 'switch',
1375
- 'title' => __('LINE', 'accelerated-mobile-pages'),
1376
- 'default' => 1,
1377
- ),
1378
- array(
1379
- 'id' => 'social-media-profiles-subsection',
1380
- 'type' => 'section',
1381
- 'title' => __('Social Media Profiles (Design #3)', 'accelerated-mobile-pages'),
1382
- 'subtitle' => __('Please enter your personal/organizational social media profiles here', 'accelerated-mobile-pages'),
1383
- 'indent' => true,
1384
- 'required' => array(
1385
- array('amp-design-selector', '=' , '3')
1386
- ),
1387
- ),
1388
- //#1
1389
- array(
1390
- 'id' => 'enable-single-twittter-profile',
1391
- 'type' => 'switch',
1392
- 'title' => __('Twitter ', 'accelerated-mobile-pages'),
1393
- 'default' => 1,
1394
- 'required' => array(
1395
- array('amp-design-selector', '=' , '3')
1396
- ),
1397
- ),
1398
- array(
1399
- 'id' => 'enable-single-twittter-profile-url',
1400
- 'type' => 'text',
1401
- 'title' => __('Twitter URL', 'accelerated-mobile-pages'),
1402
- 'default' => '#',
1403
- 'required' => array(
1404
- array('amp-design-selector', '=' , '3'),
1405
- array('enable-single-twittter-profile', '=' , '1')
1406
- ),
1407
- ),
1408
- //#2
1409
- array(
1410
- 'id' => 'enable-single-facebook-profile',
1411
- 'type' => 'switch',
1412
- 'title' => __('Facebook ', 'accelerated-mobile-pages'),
1413
- 'default' => 1,
1414
- 'required' => array(
1415
- array('amp-design-selector', '=' , '3')
1416
- ),
1417
- ),
1418
- array(
1419
- 'id' => 'enable-single-facebook-profile-url',
1420
- 'type' => 'text',
1421
- 'title' => __('Facebook URL', 'accelerated-mobile-pages'),
1422
- 'default' => '#',
1423
- 'required' => array(
1424
- array('amp-design-selector', '=' , '3'),
1425
- array('enable-single-facebook-profile', '=' , '1')
1426
- ),
1427
- ),
1428
- //#3
1429
- array(
1430
- 'id' => 'enable-single-pintrest-profile',
1431
- 'type' => 'switch',
1432
- 'title' => __('Pintrest ', 'accelerated-mobile-pages'),
1433
- 'default' => 1,
1434
- 'required' => array(
1435
- array('amp-design-selector', '=' , '3')
1436
- ),
1437
- ),
1438
- array(
1439
- 'id' => 'enable-single-pintrest-profile-url',
1440
- 'type' => 'text',
1441
- 'title' => __('Pintrest URL', 'accelerated-mobile-pages'),
1442
- 'default' => '#',
1443
- 'required' => array(
1444
- array('amp-design-selector', '=' , '3'),
1445
- array('enable-single-pintrest-profile', '=' , '1')
1446
- ),
1447
- ),
1448
- //#4
1449
- array(
1450
- 'id' => 'enable-single-google-plus-profile',
1451
- 'type' => 'switch',
1452
- 'title' => __('Google Plus ', 'accelerated-mobile-pages'),
1453
- 'default' => 0,
1454
- 'required' => array(
1455
- array('amp-design-selector', '=' , '3')
1456
- ),
1457
- ),
1458
- array(
1459
- 'id' => 'enable-single-google-plus-profile-url',
1460
- 'type' => 'text',
1461
- 'title' => __('Google Plus URL', 'accelerated-mobile-pages'),
1462
- 'default' => '',
1463
- 'required' => array(
1464
- array('amp-design-selector', '=' , '3'),
1465
- array('enable-single-google-plus-profile', '=' , '1')
1466
- ),
1467
- ),
1468
- //#5
1469
- array(
1470
- 'id' => 'enable-single-linkdin-profile',
1471
- 'type' => 'switch',
1472
- 'title' => __('Linkdin ', 'accelerated-mobile-pages'),
1473
- 'default' => 0,
1474
- 'required' => array(
1475
- array('amp-design-selector', '=' , '3')
1476
- ),
1477
- ),
1478
- array(
1479
- 'id' => 'enable-single-linkdin-profile-url',
1480
- 'type' => 'text',
1481
- 'title' => __('Linkdin URL', 'accelerated-mobile-pages'),
1482
- 'default' => '',
1483
- 'required' => array(
1484
- array('amp-design-selector', '=' , '3'),
1485
- array('enable-single-linkdin-profile', '=' , '1')
1486
- ),
1487
- ),
1488
- //#6
1489
- array(
1490
- 'id' => 'enable-single-youtube-profile',
1491
- 'type' => 'switch',
1492
- 'title' => __('Youtube ', 'accelerated-mobile-pages'),
1493
- 'default' => 1,
1494
- 'required' => array(
1495
- array('amp-design-selector', '=' , '3')
1496
- ),
1497
- ),
1498
- array(
1499
- 'id' => 'enable-single-youtube-profile-url',
1500
- 'type' => 'text',
1501
- 'default' => '#',
1502
- 'title' => __('Youtube URL', 'accelerated-mobile-pages'),
1503
- 'required' => array(
1504
- array('amp-design-selector', '=' , '3'),
1505
- array('enable-single-youtube-profile', '=' , '1')
1506
- ),
1507
- ),
1508
- //#7
1509
- array(
1510
- 'id' => 'enable-single-instagram-profile',
1511
- 'type' => 'switch',
1512
- 'title' => __('Instagram ', 'accelerated-mobile-pages'),
1513
- 'default' => 0,
1514
- 'required' => array(
1515
- array('amp-design-selector', '=' , '3')
1516
- ),
1517
- ),
1518
- array(
1519
- 'id' => 'enable-single-instagram-profile-url',
1520
- 'type' => 'text',
1521
- 'default' => '',
1522
- 'title' => __('Instagram URL', 'accelerated-mobile-pages'),
1523
- 'required' => array(
1524
- array('amp-design-selector', '=' , '3'),
1525
- array('enable-single-instagram-profile', '=' , '1')
1526
- ),
1527
- ),
1528
- //#8
1529
- array(
1530
- 'id' => 'enable-single-VKontakte-profile',
1531
- 'type' => 'switch',
1532
- 'title' => __('VKontakte ', 'accelerated-mobile-pages'),
1533
- 'default' => 0,
1534
- 'required' => array(
1535
- array('amp-design-selector', '=' , '3')
1536
- ),
1537
- ),
1538
- array(
1539
- 'id' => 'enable-single-VKontakte-profile-url',
1540
- 'type' => 'text',
1541
- 'default' => '',
1542
- 'title' => __('VKontakte URL', 'accelerated-mobile-pages'),
1543
- 'required' => array(
1544
- array('amp-design-selector', '=' , '3'),
1545
- array('enable-single-VKontakte-profile', '=' , '1')
1546
- ),
1547
- ),
1548
- //#9
1549
- //removed whatsapp
1550
- //#10
1551
- array(
1552
- 'id' => 'enable-single-reddit-profile',
1553
- 'type' => 'switch',
1554
- 'title' => __('Reddit', 'accelerated-mobile-pages'),
1555
- 'default' => 0,
1556
- 'required' => array(
1557
- array('amp-design-selector', '=' , '3')
1558
- ),
1559
- ),
1560
- array(
1561
- 'id' => 'enable-single-reddit-profile-url',
1562
- 'type' => 'text',
1563
- 'title' => __('Reddit URL', 'accelerated-mobile-pages'),
1564
- 'default' => '',
1565
- 'required' => array(
1566
- array('amp-design-selector', '=' , '3'),
1567
- array('enable-single-reddit-profile', '=' , '1')
1568
  ),
1569
- ),
1570
- //#11
1571
- array(
1572
- 'id' => 'enable-single-snapchat-profile',
1573
- 'type' => 'switch',
1574
- 'title' => __('Snapchat ', 'accelerated-mobile-pages'),
1575
- 'default' => 0,
1576
- 'required' => array(
1577
- array('amp-design-selector', '=' , '3')
1578
- ),
1579
- ),
1580
- array(
1581
- 'id' => 'enable-single-snapchat-profile-url',
1582
- 'type' => 'text',
1583
- 'title' => __('Snapchat URL', 'accelerated-mobile-pages'),
1584
- 'default' => '',
1585
- 'required' => array(
1586
- array('amp-design-selector', '=' , '3'),
1587
- array('enable-single-snapchat-profile', '=' , '1')
1588
- ),
1589
- ),
1590
- //#12
1591
- array(
1592
- 'id' => 'enable-single-Tumblr-profile',
1593
- 'type' => 'switch',
1594
- 'title' => __('Tumblr', 'accelerated-mobile-pages'),
1595
- 'default' => 0,
1596
- 'required' => array(
1597
- array('amp-design-selector', '=' , '3')
1598
- ),
1599
- ),
1600
- array(
1601
- 'id' => 'enable-single-Tumblr-profile-url',
1602
- 'type' => 'text',
1603
- 'title' => __('Tumblr URL', 'accelerated-mobile-pages'),
1604
- 'default' => '',
1605
- 'required' => array(
1606
- array('amp-design-selector', '=' , '3'),
1607
- array('enable-single-Tumblr-profile', '=' , '1')
1608
- ),
1609
- ),
1610
- )
1611
- ) );
1612
-
1613
-
1614
- // SEO SECTION
1615
- Redux::setSection( $opt_name, array(
1616
- 'title' => __( 'SEO', 'accelerated-mobile-pages' ),
1617
- 'id' => 'amp-seo',
1618
- 'subsection' => true,
1619
- 'fields' => array(
1620
-
1621
- array(
1622
- 'id' => 'ampforwp-seo-meta-description',
1623
- 'type' => 'switch',
1624
- 'title' => __('Meta Description', 'accelerated-mobile-pages'),
1625
- 'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
1626
- 'default' => 0
1627
- ),
1628
-
1629
- array(
1630
- 'id' => 'ampforwp-seo-custom-additional-meta',
1631
- 'type' => 'textarea',
1632
- 'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
1633
- 'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
1634
- 'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
1635
- 'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
1636
- ),
1637
-
1638
-
1639
- array(
1640
- 'id' => 'ampforwp-yoast-seo-sub-section',
1641
- 'type' => 'section',
1642
- 'title' => __('Yoast SEO Options', 'accelerated-mobile-pages'),
1643
- 'indent' => true
1644
- ),
1645
-
1646
- array(
1647
- 'id' => 'ampforwp-seo-yoast-meta',
1648
- 'type' => 'switch',
1649
- 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
1650
- 'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
1651
- 'default' => '1'
1652
- ),
1653
- array(
1654
- 'id' => 'ampforwp-seo-yoast-description',
1655
- 'type' => 'switch',
1656
- 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
1657
- 'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
1658
- 'default' => 0
1659
- ),
1660
-
1661
- array(
1662
- 'id' => 'ampforwp-seo-index-noindex-sub-section',
1663
- 'type' => 'section',
1664
- 'title' => __('Advanced Index & No Index Options', 'accelerated-mobile-pages'),
1665
- 'indent' => true
1666
  ),
1667
  array(
1668
  'id' => 'ampforwp-robots-archive-sub-pages-sitewide',
@@ -1717,12 +949,12 @@ Redux::setArgs( "redux_builder_amp", $args );
1717
 
1718
  // Analytics SECTION
1719
  Redux::setSection( $opt_name, array(
1720
- 'title' => __('Analytics'),
1721
- // 'icon' => 'el el-th-large',
1722
- 'desc' => __('You can either use Google Tag Manager or Other Analytics Providers','accelerated-mobile-pages'),
1723
  'subsection' => true,
1724
- 'fields' =>
1725
- array(
1726
 
1727
 
1728
  array(
@@ -1808,26 +1040,26 @@ Redux::setArgs( "redux_builder_amp", $args );
1808
  ),
1809
 
1810
  array(
1811
- 'id' =>'amp-quantcast-analytics-code',
1812
- 'type' => 'text',
1813
- 'title' => __('p-code','accelerated-mobile-pages'),
1814
- 'default' => '',
1815
  'required' => array(
1816
  array('amp-analytics-select-option', '=' , '4')),
1817
  ),
1818
  array(
1819
- 'id' =>'amp-comscore-analytics-code-c1',
1820
- 'type' => 'text',
1821
- 'title' => __('C1','accelerated-mobile-pages'),
1822
- 'default' => 1,
1823
  'required' => array(
1824
  array('amp-analytics-select-option', '=' , '5')),
1825
  ),
1826
  array(
1827
- 'id' =>'amp-comscore-analytics-code-c2',
1828
- 'type' => 'text',
1829
- 'title' => __('C2','accelerated-mobile-pages'),
1830
- 'default' => '',
1831
  'required' => array(
1832
  array('amp-analytics-select-option', '=' , '5')),
1833
  ),
@@ -1873,40 +1105,40 @@ Redux::setArgs( "redux_builder_amp", $args );
1873
  'default' => 0,
1874
  ),
1875
  array(
1876
- 'id' =>'amp-gtm-id',
1877
- 'type' => 'text',
1878
- 'title' => __('Tag Manager ID (Container ID)','accelerated-mobile-pages'),
1879
- 'default' => '',
1880
- 'desc' => __('Eg: GTM-5XXXXXP (<a href="https://ampforwp.com/tutorials/article/gtm-in-amp/">Getting Started?</a>)','accelerated-mobile-pages'),
1881
  // 'validate' => 'not_empty',
1882
  'required' => array(
1883
  array('amp-use-gtm-option', '=' , '1')
1884
  ),
1885
- ),
1886
- array(
1887
- 'id' =>'amp-gtm-analytics-type',
1888
- 'type' => 'text',
1889
- 'title' => __('Analytics Type','accelerated-mobile-pages'),
1890
- 'default' => '',
1891
- 'desc' => __('Eg: googleanalytics','accelerated-mobile-pages'),
1892
  // 'validate' => 'not_empty',
1893
  'required' => array(
1894
  array('amp-use-gtm-option', '=' , '1')
1895
  ),
1896
- ),
1897
- array(
1898
- 'id' =>'amp-gtm-analytics-code',
1899
- 'type' => 'text',
1900
- 'title' => __('Analytics ID','accelerated-mobile-pages'),
1901
- 'default' => '',
1902
- 'desc' => 'Eg: UA-XXXXXX-Y',
1903
  // 'validate' => 'not_empty',
1904
  'required' => array(
1905
  array('amp-use-gtm-option', '=' , '1')),
1906
- ),
1907
 
1908
- )
1909
- )
1910
  );
1911
 
1912
  // Structured Data
@@ -1972,48 +1204,6 @@ Redux::setArgs( "redux_builder_amp", $args );
1972
  )
1973
  ) );
1974
 
1975
- // Contact Form SECTION
1976
- Redux::setSection( $opt_name, array(
1977
- 'title' => __( 'Contact Form', 'accelerated-mobile-pages' ),
1978
- 'desc' => 'Contact form 7 forms will automatically be converted into AMP compatible.',
1979
- 'id' => 'amp-contact',
1980
- 'subsection' => true,
1981
- 'fields' => array(
1982
- array(
1983
- 'id' =>'amp-enable-contactform',
1984
- 'type' => 'switch',
1985
- 'title' => __('Contact Form 7 Support', 'accelerated-mobile-pages'),
1986
- 'default' => '',
1987
- 'true' => 'Enabled',
1988
- 'false' => 'Disabled',
1989
- ),
1990
-
1991
- array(
1992
- // 'title' => __('Notification text', 'accelerated-mobile-pages'),
1993
- 'id' => 'info_normal',
1994
- 'type' => 'info',
1995
- 'required' => array('amp-enable-contactform', '=' , '1'),
1996
- 'desc' => '<div style=" background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -35px -12px 0 -12px;"><b>ONE LAST STEP REQUIRED:</b> This feature requires <a href="https://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=cf7-tab_cf7_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Contact Form 7 extension</a>.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=cf7-tab_cf7_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Click here for more info</a>)</div></div>',
1997
- ),
1998
- array(
1999
- 'id' =>'amp-enable-gravityforms_support',
2000
- 'type' => 'switch',
2001
- 'title' => __('Gravity Forms Support', 'accelerated-mobile-pages'),
2002
- 'default' => '',
2003
- 'true' => 'Enabled',
2004
- 'false' => 'Disabled',
2005
- ),
2006
- array(
2007
- // 'title' => __('Notification text', 'accelerated-mobile-pages'),
2008
- 'id' => 'info_normal_2',
2009
- 'type' => 'info',
2010
- 'required' => array('amp-enable-gravityforms_support', '=' , '1'),
2011
- 'desc' => '<div style=" background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -35px -12px 0 -12px;"><b>ONE LAST STEP REQUIRED:</b> This feature requires <a href="https://ampforwp.com/gravity-forms/#utm_source=options-panel&utm_medium=gf-tab_gf_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Gravity Forms extension</a>.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/gravity-forms/#utm_source=options-panel&utm_medium=gf-tab_gf_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Click here for more info</a>)</div></div>',
2012
- ),
2013
- ),
2014
-
2015
- ) );
2016
-
2017
  // Notifications SECTION
2018
  Redux::setSection( $opt_name, array(
2019
  'title' => __( 'Notifications', 'accelerated-mobile-pages' ),
@@ -2050,7 +1240,52 @@ Redux::setArgs( "redux_builder_amp", $args );
2050
  ),
2051
 
2052
  ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2053
 
 
2054
 
2055
  // Comments
2056
  Redux::setSection( $opt_name, array(
@@ -2126,48 +1361,207 @@ Redux::setArgs( "redux_builder_amp", $args );
2126
  )
2127
  ) );
2128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2129
 
2130
- // Translation Panel
2131
- Redux::setSection( $opt_name, array(
2132
- 'title' => __( 'Translation Panel', 'accelerated-mobile-pages' ),
2133
- 'desc' => __( 'Please translate the following words of page accordingly else default content is in English Language', 'accelerated-mobile-pages' ),
2134
- 'id' => 'amp-translator',
2135
- 'subsection' => true,
2136
- 'fields' => array(
2137
- array(
2138
- 'id' => 'amp-use-pot',
2139
- 'type' => 'switch',
2140
- 'title' => __('Use POT file method of Translation', 'accelerated-mobile-pages'),
2141
- 'subtitle' => __('Else you can use normal translation method', 'accelerated-mobile-pages'),
2142
- 'desc' => __('Use this if you want Multilingual Translations', 'accelerated-mobile-pages'),
2143
- 'default' => 0
2144
- ),
2145
- array(
2146
- 'id' => 'amp-translator-show-more-posts-text',
2147
- 'type' => 'text',
2148
- 'title' => __('Show more Posts', 'accelerated-mobile-pages'),
2149
- 'default' => __('Show more Posts','accelerated-mobile-pages'),
2150
- 'placeholder'=>__('write here','accelerated-mobile-pages'),
2151
- 'required' => array( 'amp-use-pot', '=' , 0 )
2152
- ),
2153
- array(
2154
- 'id' => 'amp-translator-show-previous-posts-text',
2155
- 'type' => 'text',
2156
- 'title' => __('Show previous Posts', 'accelerated-mobile-pages'),
2157
- 'default' => __('Show previous Posts','accelerated-mobile-pages'),
2158
- 'placeholder'=>__('write here','accelerated-mobile-pages'),
2159
- 'required' => array( 'amp-use-pot', '=' , 0 )
2160
- ),
2161
- array(
2162
- 'id' => 'amp-translator-top-text',
2163
- 'type' => 'text',
2164
- 'title' => __('Top', 'accelerated-mobile-pages'),
2165
- 'default' => __('Top','accelerated-mobile-pages'),
2166
- 'placeholder'=>__('write here','accelerated-mobile-pages'),
2167
- 'required' => array( 'amp-use-pot', '=' , 0 )
2168
- ),
2169
- array(
2170
- 'id' => 'amp-translator-non-amp-page-text',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2171
  'type' => 'text',
2172
  'title' => __('View Non-AMP Version', 'accelerated-mobile-pages'),
2173
  'default' => __('View Non-AMP Version','accelerated-mobile-pages'),
@@ -2400,141 +1794,854 @@ Redux::setArgs( "redux_builder_amp", $args );
2400
  'placeholder'=>__('write here','accelerated-mobile-pages'),
2401
  'required' => array( 'amp-use-pot', '=' , 0 )
2402
 
2403
- )
2404
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2405
 
2406
- function fb_instant_article(){
2407
- $feedname = '';
2408
- $fb_instant_article_feed = '';
2409
- $feedname = 'instant_articles';
2410
- $fb_instant_article_feed = trailingslashit( site_url() ).$feedname ;
2411
- return esc_url( $fb_instant_article_feed );
2412
- }
2413
- // Facebook Instant Articles
2414
- Redux::setSection( $opt_name, array(
2415
- 'title' => __( 'Facebook Instant Articles', 'accelerated-mobile-pages' ),
2416
- 'id' => 'fb-instant-article',
2417
- 'subsection' => true,
2418
- 'fields' => array(
2419
- array(
2420
- 'id' =>'fb-instant-article-switch',
2421
- 'type' => 'switch',
2422
- 'title' => __('Facebook Instant Articles Support', 'accelerated-mobile-pages'),
2423
- 'default' => 0,
2424
- 'true' => 'true',
2425
- 'false' => 'false',
2426
- 'desc' => __('Re-Save permalink when you enable this option, please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages'),
2427
- ),
2428
- array(
2429
- 'id' => 'fb-instant-article-feed-url',
2430
- 'type' => 'info',
2431
- 'style' => 'critical',
2432
- 'desc' => fb_instant_article(),
2433
- 'title' => __('Facebook Instant Articles Feed URL', 'accelerated-mobile-pages'),
2434
- 'required' => array('fb-instant-article-switch', '=', 1)
2435
- ),
2436
- array(
2437
- 'id' => 'fb-instant-article-ads',
2438
- 'type' => 'switch',
2439
- 'title' => __('Advertisement', 'accelerated-mobile-pages'),
2440
- 'default' => 0,
2441
- 'true' => 'true',
2442
- 'false' => 'false',
2443
- 'desc' => __('Switch this on to enable advertising on Instant Article pages.', 'accelerated-mobile-pages'),
2444
- 'required' => array('fb-instant-article-switch', '=', 1)
2445
- ),
2446
- array(
2447
- 'id' => 'fb-instant-article-ad-id',
2448
- 'type' => 'text',
2449
- 'title' => __('Enter your Audience Network Placement ID', 'accelerated-mobile-pages'),
2450
- 'subtitle' => __('You can find out more about this <a href="https://developers.facebook.com/docs/instant-articles/monetization/audience-network">here</a>. ', 'accelerated-mobile-pages'),
2451
- 'required' => array('fb-instant-article-ads', '=', 1)
2452
- ),
2453
- array(
2454
- 'id' => 'fb-instant-article-analytics',
2455
- 'type' => 'switch',
2456
- 'title' => __('Analytics', 'accelerated-mobile-pages'),
2457
- 'default' => 0,
2458
  'true' => 'true',
2459
  'false' => 'false',
2460
- 'desc' => __('Switch this on to enable analytics on Instant Article pages.', 'accelerated-mobile-pages'),
2461
- 'required' => array('fb-instant-article-switch', '=', 1)
2462
- ),
2463
- array(
2464
- 'id' => 'fb-instant-article-analytics-code',
2465
- 'type' => 'textarea',
2466
- 'title' => __('Enter your Analytics script code', 'accelerated-mobile-pages'),
2467
- 'subtitle' => __('Do not enter iframe tag. Find out more about support <a href="https://developers.facebook.com/docs/instant-articles/analytics">here</a> ', 'accelerated-mobile-pages'),
2468
- 'required' => array('fb-instant-article-analytics', '=', 1)
2469
- ),
2470
- ),
2471
- )
2472
- );
2473
- Redux::setSection( $opt_name, array(
2474
- 'title' => __( 'Hide AMP Bulk Tools', 'accelerated-mobile-pages' ),
2475
- 'id' => 'hide-amp-section',
2476
- 'subsection' => true,
2477
- 'desc' => 'Here are some Advanced options to help you exclude AMP from your prefered pages',
2478
- 'fields' => array(
2479
 
2480
- array(
2481
- 'id' => 'amp-pages-meta-default',
2482
- 'type' => 'select',
2483
- 'title' => __( 'Individual AMP Page (Bulk Edit)', 'accelerated-mobile-pages' ),
2484
- 'subtitle' => __( 'Allows you to Show or Hide AMP from All pages, so it can be changed individually later. This option will change the Default value of AMP metabox in Pages', 'accelerated-mobile-pages' ),
2485
- 'desc' => __( 'NOTE: Changes will overwrite the previous settings.', 'accelerated-mobile-pages' ),
2486
- 'options' => array(
2487
- 'show' => __('Show by Default', 'accelerated-mobile-pages' ),
2488
- 'hide' => __('Hide by default', 'accelerated-mobile-pages' ),
2489
- ),
2490
- 'default' => 'show',
2491
- 'required'=>array('amp-on-off-for-all-pages','=','1'),
2492
- ),
2493
- array(
2494
- 'id' =>'hide-amp-categories',
2495
- 'type' => 'checkbox',
2496
- 'title' => __('Select Categories to Hide AMP'),
2497
- 'subtitle' => __( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
2498
- 'default' => 0,
2499
- 'data' => 'categories',
2500
- ),
2501
- )
2502
- )
2503
- );
2504
 
2505
- // Advance Settings SECTION
2506
- Redux::setSection( $opt_name, array(
2507
- 'title' => __( 'Advance Settings', 'accelerated-mobile-pages' ),
2508
- 'desc' => __( 'This section has Advance settings','accelerated-mobile-pages'),
2509
- 'id' => 'amp-advance',
2510
- 'subsection' => true,
2511
- 'fields' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2512
 
2513
- /* array(
2514
- 'id' => 'ampforwp-homepage-on-off-support',
2515
- 'type' => 'switch',
2516
- 'title' => __('Homepage Support', 'accelerated-mobile-pages'),
2517
- 'subtitle' => __('Enable/Disable Home page using this switch.', 'accelerated-mobile-pages'),
2518
- 'default' => '1'
2519
- ),*/
2520
- array(
2521
- 'id' => 'ampforwp-archive-support',
2522
- 'type' => 'switch',
2523
- 'title' => __('Archive page Support', 'accelerated-mobile-pages'),
2524
- 'subtitle' => __('Enable/Disable Archive pages using this switch.', 'accelerated-mobile-pages'),
2525
- 'default' => '0'
2526
- ),
2527
- array(
2528
- 'id' => 'amp-mobile-redirection',
2529
- 'type' => 'switch',
2530
- 'title' => __('Mobile Redirection', 'accelerated-mobile-pages'),
2531
- 'subtitle' => __('
2532
- Enable AMP for your mobile users. Give your visitors a Faster mobile User Experience.','accelerated-mobile-pages'),
2533
- 'default' => 0,
2534
 
2535
- ),
 
 
 
 
 
 
 
2536
 
2537
- array(
 
2538
  'id' =>'amp-rtl-select-option',
2539
  'type' => 'switch',
2540
  'title' => __('RTL Support', 'accelerated-mobile-pages'),
@@ -2543,36 +2650,12 @@ Redux::setSection( $opt_name, array(
2543
  'true' => 'true',
2544
  'false' => 'false',
2545
  ),
2546
- array(
2547
- 'id' => 'amp-footer-link-non-amp-page',
2548
- 'type' => 'switch',
2549
- 'title' => __('Link to Non-AMP page in Footer', 'accelerated-mobile-pages'),
2550
- 'subtitle' => __('Enable / Disable Link to Non-AMP page in the footer', 'accelerated-mobile-pages'),
2551
- 'true' => 'true',
2552
- 'false' => 'false',
2553
- 'default' => 1
2554
- ),
2555
- array(
2556
- 'id' => 'amp-header-text-area-for-html',
2557
- 'type' => 'textarea',
2558
- 'title' => __('Enter HTML in Header', 'accelerated-mobile-pages'),
2559
- 'subtitle' => __('please enter markup that is AMP validated', 'accelerated-mobile-pages'),
2560
- 'desc' => __('check your markup here (enter markup between HEAD tag) : https://validator.ampproject.org/', 'accelerated-mobile-pages'),
2561
- 'default' => ''
2562
- ),
2563
- array(
2564
- 'id' => 'amp-footer-text-area-for-html',
2565
- 'type' => 'textarea',
2566
- 'title' => __('Enter HTML in Footer', 'accelerated-mobile-pages'),
2567
- 'subtitle' => __('please enter markup that is AMP validated', 'accelerated-mobile-pages'),
2568
- 'desc' => __('check your markup here (enter markup between BODY tag) : https://validator.ampproject.org/',
2569
- 'accelerated-mobile-pages'),
2570
- 'default' => ''
2571
- ),
2572
 
2573
- ),
2574
 
2575
- ) );
 
2576
  // Extension Section
2577
  Redux::setSection( $opt_name, array(
2578
  'title' => __( 'Extensions', 'accelerated-mobile-pages' ),
@@ -2580,6 +2663,7 @@ Redux::setSection( $opt_name, array(
2580
  'id' => 'opt-go-premium',
2581
  'subsection' => false,
2582
  'desc' => $extension_listing,
 
2583
  // 'desc' => '<a href="http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=extension-tab_advanced-amp-ads&utm_campaign=AMP%20Plugin" target="_blank"><img class="ampforwp-extension-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-ads-extension.png" width="345" height="500" /></a>
2584
  //
2585
  // <a href="http://ampforwp.com/custom-post-type/#utm_source=options-panel&utm_medium=extension-tab_custom-post-type&utm_campaign=AMP%20Plugin" target="_blank"><img class="ampforwp-extension-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-custom-post-type-extension.png" width="345" height="500" /></a>
1
  <?php
2
+ //Admin Panel Options
3
  if ( ! class_exists( 'Redux' ) ) {
4
  return;
5
  }
6
  // Option name where all the Redux data is stored.
7
  $opt_name = "redux_builder_amp";
8
+ $amptfad = '<strong>Did you know:</strong></br ><a href="https://ampforwp.com/amp-theme-framework/" target="_blank">You can create your own <strong>Custom theme with AMP Theme Framework</strong></a>';
9
  $comment_AD_URL = "http://ampforwp.com/amp-comments/#utm_source=options-panel&utm_medium=comments-tab&utm_campaign=AMP%20Plugin";
10
  $cta_AD_URL = "http://ampforwp.com/call-to-action/#utm_source=options-panel&utm_medium=call-to-action_banner_in_notification_bar&utm_campaign=AMP%20Plugin";
11
  $comment_desc = '<a href="'.$comment_AD_URL.'" target="_blank"><img class="ampforwp-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/comments-banner.png" width="560" height="85" /></a>';
89
  <div class="extension_btn">From: $19</div>
90
  </div>
91
  </a></li>
92
+ <li class="first"><a href="https://ampforwp.com/woocommerce/" target="_blank">
93
  <div class="align_left"><img src="'.AMPFORWP_IMAGE_DIR . '/woo.png" /></div>
94
  <div class="extension_desc">
95
+ <h2>AMP WooCommerce Pro</h2>
96
+ <p>Advanced WooCommerce in AMP in two clicks.</p>
97
+ <div class="extension_btn">From: $79</div>
98
  </div>
99
  </a></li>
100
 
183
  <div class="extension_btn">From: $19</div>
184
  </div>
185
  </a></li>
186
+ <li class="second"><a href="https://ampforwp.com/woocommerce/" target="_blank">
187
  <div class="align_left"><img src="'.AMPFORWP_IMAGE_DIR . '/woo.png" /></div>
188
  <div class="extension_desc">
189
+ <h2>AMP WooCommerce Pro</h2>
190
+ <p>Advanced WooCommerce in AMP in two clicks.</p>
191
+ <div class="extension_btn">From: $79</div>
192
  </div>
193
  </a></li>
194
 
373
  ) );
374
 
375
  Redux::setSection( $opt_name, array(
376
+ 'title' => __( 'Settings', 'accelerated-mobile-pages' ),
377
  'id' => 'basic',
378
  'desc' => __( '<div class="amp-faq">Thank you for using Accelerated Mobile Pages plugin. '. ' ' .
379
 
397
  ' .$gettingstarted_extension_listing
398
 
399
  , 'accelerated-mobile-pages' ),
400
+ 'icon' => 'el el-cogs'
401
  ) );
402
 
403
  Redux::setSection( $opt_name, array(
415
  'subtitle' => __('Upload a logo for the AMP version.', 'accelerated-mobile-pages'),
416
  'desc' => __('Recommend logo size is: 190x36', 'accelerated-mobile-pages')
417
  ),
418
+ array(
419
  'id' => 'ampforwp-custom-logo-dimensions',
420
  'title' => __('Custom Logo Size', 'accelerated-mobile-pages'),
421
  'type' => 'switch',
422
  'default' => 0,
423
  ),
424
+ array(
425
  'id' => 'opt-media-width',
426
  'type' => 'text',
427
  'title' => __('Logo Width', 'accelerated-mobile-pages'),
429
  'default' => '190',
430
  'required'=>array('ampforwp-custom-logo-dimensions','=','1'),
431
  ),
432
+ array(
433
  'id' => 'opt-media-height',
434
  'type' => 'text',
435
  'title' => __('Logo Height', 'accelerated-mobile-pages'),
438
  'required'=>array('ampforwp-custom-logo-dimensions','=','1'),
439
 
440
  ),
441
+ array(
442
+ 'id' => 'amp-support',
443
+ 'type' => 'section',
444
+ 'title' => __('AMP Support', 'accelerated-mobile-pages'),
445
+ 'indent' => true,
446
+ ),
447
  array(
448
  'id' =>'amp-on-off-for-all-pages',
449
  'type' => 'switch',
452
  'default' => 1,
453
  'desc' => __( 'Re-Save permalink if you make changes in this option, please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages' ),
454
  ),
455
+ array(
456
+ 'id' => 'ampforwp-homepage-on-off-support',
457
+ 'type' => 'switch',
458
+ 'title' => __('Homepage Support', 'accelerated-mobile-pages'),
459
+ 'subtitle' => __('Enable/Disable Home page using this switch.', 'accelerated-mobile-pages'),
460
+ 'default' => '1'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  ),
462
+ array(
463
  'id' =>'amp-frontpage-select-option',
464
  'type' => 'switch',
465
  'title' => __('Front Page', 'accelerated-mobile-pages'),
470
  'required' => array('ampforwp-homepage-on-off-support','=','1'),
471
  'desc' => __( 'Re-Save permalink if front page or custom post page\'s pagination is not working. Please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages' ),
472
  ),
473
+ array(
474
  'id' => 'amp-frontpage-select-option-pages',
475
  'type' => 'select',
476
  'title' => __('Select Page as Front Page', 'accelerated-mobile-pages'),
483
  ),
484
  'default' => '2',
485
  ),
486
+ array(
487
  'id' => 'ampforwp-title-on-front-page',
488
  'type' => 'switch',
489
  'url' => true,
492
  'default' => 0,
493
  'required' => array('amp-frontpage-select-option', '=' , '1'),
494
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  array(
496
+ 'id' => 'ampforwp-archive-support',
497
+ 'type' => 'switch',
498
+ 'title' => __('Archive page Support', 'accelerated-mobile-pages'),
499
+ 'subtitle' => __('Enable/Disable Archive pages using this switch.', 'accelerated-mobile-pages'),
500
+ 'default' => '0'
501
+ ),
502
+
503
+ // array(
504
+ // 'id' => 'amp-ad-places',
505
+ // 'type' => 'select',
506
+ // 'title' => __( 'Ads on Page', 'accelerated-mobile-pages' ),
507
+ // 'subtitle' => __( 'select your preferece for Ads on Post Types', 'accelerated-mobile-pages' ),
508
+ // 'options' => array(
509
+ // '1' => __('Only on Posts', 'accelerated-mobile-pages' ),
510
+ // '2' => __('Only on Pages', 'accelerated-mobile-pages' ),
511
+ // '3' => __('on Both', 'accelerated-mobile-pages' ),
512
+ // ),
513
+ // 'default' => '3'
514
+ // ),
515
+
516
+ )
517
+ ) );//END
518
 
519
  // AMP Content Page Builder SECTION
520
  Redux::setSection( $opt_name, array(
545
 
546
  ) ;
547
 
548
+ $AD_URL = "http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=advertisement-tab&utm_campaign=AMP%20Plugin";
549
+ $desc = '';
550
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
551
+ if(!is_plugin_active( 'amp-incontent-ads/amptoolkit-incontent-ads.php' ) ){
552
 
553
+ $desc = '<a href="'.$AD_URL.'" target="_blank"><img class="ampforwp-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-ads-retina.png" width="560" height="85" /></a>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
554
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
+ // ADS SECTION
557
+ Redux::setSection( $opt_name, array(
558
+ 'title' => __( 'Advertisement', 'accelerated-mobile-pages' ),
559
+ 'desc' => $desc,
560
+ 'id' => 'amp-ads',
561
+ 'subsection' => true,
562
+ 'fields' => array(
563
+ // Ad 1 Starts
564
+ array(
565
+ 'id' =>'enable-amp-ads-1',
566
+ 'type' => 'switch',
567
+ 'title' => __('AD #1', 'accelerated-mobile-pages'),
568
+ 'default' => 0,
569
+ 'subtitle' => __('Below the Header (SiteWide)', 'accelerated-mobile-pages'),
570
+ 'true' => 'Enabled',
571
+ 'false' => 'Disabled',
 
572
  ),
573
+ array(
574
+ 'id' => 'enable-amp-ads-select-1',
575
+ 'type' => 'select',
576
+ 'title' => __('AD Size', 'accelerated-mobile-pages'),
577
+ 'required' => array('enable-amp-ads-1', '=' , '1'),
578
+ // Must provide key => value pairs for select options
579
+ 'options' => array(
580
+ '1' => __('300x250','accelerated-mobile-pages'),
581
+ '2' => __('336x280','accelerated-mobile-pages'),
582
+ '3' => __('728x90','accelerated-mobile-pages'),
583
+ '4' => __('300x600','accelerated-mobile-pages'),
584
+ '5' => __('320x100','accelerated-mobile-pages'),
585
+ '6' => __('200x50','accelerated-mobile-pages'),
586
+ '7' => __('320x50','accelerated-mobile-pages'), ),
587
+ 'default' => '2',
588
  ),
589
+ array(
590
+ 'id' =>'enable-amp-ads-text-feild-client-1',
591
+ 'type' => 'text',
592
+ 'required' => array('enable-amp-ads-1', '=' , '1'),
593
+ 'title' => __('Data AD Client', 'accelerated-mobile-pages'),
594
+ 'subtitle' => __('Enter the Data Ad Client (data-ad-client) from the adsense ad code.', 'accelerated-mobile-pages'),
595
+ 'default' => '',
596
+ 'placeholder'=> 'ca-pub-2005XXXXXXXXX342'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  ),
598
+ array(
599
+ 'id' => 'enable-amp-ads-text-feild-slot-1',
600
+ 'type' => 'text',
601
+ 'title' => __('Data AD Slot', 'accelerated-mobile-pages'),
602
+ 'subtitle' => __('Enter the Data Ad Slot (data-ad-slot) from the adsense ad code.', 'accelerated-mobile-pages'),
603
+ 'default' => '',
604
+ 'required' => array('enable-amp-ads-1', '=' , '1'),
605
+ 'placeholder'=> '70XXXXXX12'
606
+ ),
607
+ // Ad 1 ends
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
608
 
609
  // Ad 2 Starts
610
  array(
842
 
843
  ),
844
  ) );
 
845
 
846
+ // SEO SECTION
847
+ Redux::setSection( $opt_name, array(
848
+ 'title' => __( 'SEO', 'accelerated-mobile-pages' ),
849
+ 'id' => 'amp-seo',
850
+ 'subsection' => true,
851
+ 'fields' => array(
852
 
853
+ array(
854
+ 'id' => 'ampforwp-seo-meta-description',
855
+ 'type' => 'switch',
856
+ 'title' => __('Meta Description', 'accelerated-mobile-pages'),
857
+ 'subtitle' => __('The meta tag that displays in head', 'accelerated-mobile-pages'),
858
+ 'default' => 0
859
+ ),
860
 
861
+ array(
862
+ 'id' => 'ampforwp-seo-custom-additional-meta',
863
+ 'type' => 'textarea',
864
+ 'title' => __('Additional tags for Head section AMP page', 'accelerated-mobile-pages'),
865
+ 'subtitle' => __('Adds additional Meta to the head section', 'accelerated-mobile-pages', 'accelerated-mobile-pages'),
866
+ 'desc' => __('Only link and meta tags allowed', 'accelerated-mobile-pages'),
867
+ 'placeholder' => __('<!-- Paste your Additional HTML , that goes between <head> </head> tags -->','accelerated-mobile-pages')
868
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
869
 
 
870
 
871
+ array(
872
+ 'id' => 'ampforwp-yoast-seo-sub-section',
873
+ 'type' => 'section',
874
+ 'title' => __('Yoast SEO Options', 'accelerated-mobile-pages'),
875
+ 'indent' => true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  ),
877
+
878
+ array(
879
+ 'id' => 'ampforwp-seo-yoast-meta',
880
+ 'type' => 'switch',
881
+ 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
882
+ 'title' => __( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
883
+ 'default' => '1'
884
+ ),
885
+ array(
886
+ 'id' => 'ampforwp-seo-yoast-description',
887
+ 'type' => 'switch',
888
+ 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
889
+ 'title' => __( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
890
+ 'default' => 0
891
+ ),
892
+
893
+ array(
894
+ 'id' => 'ampforwp-seo-index-noindex-sub-section',
895
+ 'type' => 'section',
896
+ 'title' => __('Advanced Index & No Index Options', 'accelerated-mobile-pages'),
897
+ 'indent' => true
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
898
  ),
899
  array(
900
  'id' => 'ampforwp-robots-archive-sub-pages-sitewide',
949
 
950
  // Analytics SECTION
951
  Redux::setSection( $opt_name, array(
952
+ 'title' => __('Analytics'),
953
+ // 'icon' => 'el el-th-large',
954
+ 'desc' => __('You can either use Google Tag Manager or Other Analytics Providers','accelerated-mobile-pages'),
955
  'subsection' => true,
956
+ 'fields' =>
957
+ array(
958
 
959
 
960
  array(
1040
  ),
1041
 
1042
  array(
1043
+ 'id' =>'amp-quantcast-analytics-code',
1044
+ 'type' => 'text',
1045
+ 'title' => __('p-code','accelerated-mobile-pages'),
1046
+ 'default' => '',
1047
  'required' => array(
1048
  array('amp-analytics-select-option', '=' , '4')),
1049
  ),
1050
  array(
1051
+ 'id' =>'amp-comscore-analytics-code-c1',
1052
+ 'type' => 'text',
1053
+ 'title' => __('C1','accelerated-mobile-pages'),
1054
+ 'default' => 1,
1055
  'required' => array(
1056
  array('amp-analytics-select-option', '=' , '5')),
1057
  ),
1058
  array(
1059
+ 'id' =>'amp-comscore-analytics-code-c2',
1060
+ 'type' => 'text',
1061
+ 'title' => __('C2','accelerated-mobile-pages'),
1062
+ 'default' => '',
1063
  'required' => array(
1064
  array('amp-analytics-select-option', '=' , '5')),
1065
  ),
1105
  'default' => 0,
1106
  ),
1107
  array(
1108
+ 'id' =>'amp-gtm-id',
1109
+ 'type' => 'text',
1110
+ 'title' => __('Tag Manager ID (Container ID)','accelerated-mobile-pages'),
1111
+ 'default' => '',
1112
+ 'desc' => __('Eg: GTM-5XXXXXP (<a href="https://ampforwp.com/tutorials/article/gtm-in-amp/">Getting Started?</a>)','accelerated-mobile-pages'),
1113
  // 'validate' => 'not_empty',
1114
  'required' => array(
1115
  array('amp-use-gtm-option', '=' , '1')
1116
  ),
1117
+ ),
1118
+ array(
1119
+ 'id' =>'amp-gtm-analytics-type',
1120
+ 'type' => 'text',
1121
+ 'title' => __('Analytics Type','accelerated-mobile-pages'),
1122
+ 'default' => '',
1123
+ 'desc' => __('Eg: googleanalytics','accelerated-mobile-pages'),
1124
  // 'validate' => 'not_empty',
1125
  'required' => array(
1126
  array('amp-use-gtm-option', '=' , '1')
1127
  ),
1128
+ ),
1129
+ array(
1130
+ 'id' =>'amp-gtm-analytics-code',
1131
+ 'type' => 'text',
1132
+ 'title' => __('Analytics ID','accelerated-mobile-pages'),
1133
+ 'default' => '',
1134
+ 'desc' => 'Eg: UA-XXXXXX-Y',
1135
  // 'validate' => 'not_empty',
1136
  'required' => array(
1137
  array('amp-use-gtm-option', '=' , '1')),
1138
+ ),
1139
 
1140
+ )
1141
+ )
1142
  );
1143
 
1144
  // Structured Data
1204
  )
1205
  ) );
1206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
  // Notifications SECTION
1208
  Redux::setSection( $opt_name, array(
1209
  'title' => __( 'Notifications', 'accelerated-mobile-pages' ),
1240
  ),
1241
 
1242
  ) );
1243
+ // contact form 7
1244
+ $forms_support[] = array(
1245
+ 'id' =>'amp-enable-contactform',
1246
+ 'type' => 'switch',
1247
+ 'title' => __('Contact Form 7 Support', 'accelerated-mobile-pages'),
1248
+ 'default' => '',
1249
+ 'true' => 'Enabled',
1250
+ 'false' => 'Disabled',
1251
+ );
1252
+
1253
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1254
+ if(!is_plugin_active( 'AMP-CF7/amp-cf7.php' ) ){
1255
+ $forms_support[]= array(
1256
+ 'id' => 'info_normal_cf7',
1257
+ 'type' => 'info',
1258
+ 'required' => array('amp-enable-contactform', '=' , '1'),
1259
+ 'desc' => '<div style=" background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -35px -12px 0 -12px;"><b>ONE LAST STEP REQUIRED:</b> This feature requires <a href="https://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=cf7-tab_cf7_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Contact Form 7 extension</a>.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/contact-form-7/#utm_source=options-panel&utm_medium=cf7-tab_cf7_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Click here for more info</a>)</div></div>',
1260
+ );
1261
+ }
1262
+ // gravity form
1263
+ $forms_support[]= array(
1264
+ 'id' =>'amp-enable-gravityforms_support',
1265
+ 'type' => 'switch',
1266
+ 'title' => __('Gravity Forms Support', 'accelerated-mobile-pages'),
1267
+ 'default' => '',
1268
+ 'true' => 'Enabled',
1269
+ 'false' => 'Disabled',
1270
+ );
1271
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1272
+ if(!is_plugin_active( 'amp-gravity-forms/amp-gravity-forms.php' ) ){
1273
+ $forms_support[]= array(
1274
+ 'id' => 'info_normal_2',
1275
+ 'type' => 'info',
1276
+ 'required' => array('amp-enable-gravityforms_support', '=' , '1'),
1277
+ 'desc' => '<div style=" background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -35px -12px 0 -12px;"><b>ONE LAST STEP REQUIRED:</b> This feature requires <a href="https://ampforwp.com/gravity-forms/#utm_source=options-panel&utm_medium=gf-tab_gf_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Gravity Forms extension</a>.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/gravity-forms/#utm_source=options-panel&utm_medium=gf-tab_gf_installation_link&utm_campaign=AMP%20Plugin" target="_blank">Click here for more info</a>)</div></div>',
1278
+ );}
1279
+
1280
+ // Contact Form SECTION
1281
+ Redux::setSection( $opt_name, array(
1282
+ 'title' => __( 'Contact Form', 'accelerated-mobile-pages' ),
1283
+ 'desc' => 'Contact form 7 forms will automatically be converted into AMP compatible.',
1284
+ 'id' => 'amp-contact',
1285
+ 'subsection' => true,
1286
+ 'fields' => $forms_support
1287
 
1288
+ ) );
1289
 
1290
  // Comments
1291
  Redux::setSection( $opt_name, array(
1361
  )
1362
  ) );
1363
 
1364
+ function fb_instant_article(){
1365
+ $feedname = '';
1366
+ $fb_instant_article_feed = '';
1367
+ $feedname = 'instant_articles';
1368
+ $fb_instant_article_feed = trailingslashit( site_url() ).$feedname ;
1369
+ return esc_url( $fb_instant_article_feed );
1370
+ }
1371
+ // Facebook Instant Articles
1372
+ Redux::setSection( $opt_name, array(
1373
+ 'title' => __( 'Facebook Instant Articles', 'accelerated-mobile-pages' ),
1374
+ 'id' => 'fb-instant-article',
1375
+ 'subsection' => true,
1376
+ 'fields' => array(
1377
+ array(
1378
+ 'id' =>'fb-instant-article-switch',
1379
+ 'type' => 'switch',
1380
+ 'title' => __('Facebook Instant Articles Support', 'accelerated-mobile-pages'),
1381
+ 'default' => 0,
1382
+ 'true' => 'true',
1383
+ 'false' => 'false',
1384
+ 'desc' => __('Re-Save permalink when you enable this option, please have a look <a href="https://ampforwp.com/flush-rewrite-urls/">here</a> on how to do it', 'accelerated-mobile-pages'),
1385
+ ),
1386
+ array(
1387
+ 'id' => 'fb-instant-article-feed-url',
1388
+ 'type' => 'info',
1389
+ 'style' => 'critical',
1390
+ 'desc' => fb_instant_article(),
1391
+ 'title' => __('Facebook Instant Articles Feed URL', 'accelerated-mobile-pages'),
1392
+ 'required' => array('fb-instant-article-switch', '=', 1)
1393
+ ),
1394
+ array(
1395
+ 'id' => 'fb-instant-article-ads',
1396
+ 'type' => 'switch',
1397
+ 'title' => __('Advertisement', 'accelerated-mobile-pages'),
1398
+ 'default' => 0,
1399
+ 'true' => 'true',
1400
+ 'false' => 'false',
1401
+ 'desc' => __('Switch this on to enable advertising on Instant Article pages.', 'accelerated-mobile-pages'),
1402
+ 'required' => array('fb-instant-article-switch', '=', 1)
1403
+ ),
1404
+ array(
1405
+ 'id' => 'fb-instant-article-ad-id',
1406
+ 'type' => 'text',
1407
+ 'title' => __('Enter your Audience Network Placement ID', 'accelerated-mobile-pages'),
1408
+ 'subtitle' => __('You can find out more about this <a href="https://developers.facebook.com/docs/instant-articles/monetization/audience-network">here</a>. ', 'accelerated-mobile-pages'),
1409
+ 'required' => array('fb-instant-article-ads', '=', 1)
1410
+ ),
1411
+ array(
1412
+ 'id' => 'fb-instant-article-analytics',
1413
+ 'type' => 'switch',
1414
+ 'title' => __('Analytics', 'accelerated-mobile-pages'),
1415
+ 'default' => 0,
1416
+ 'true' => 'true',
1417
+ 'false' => 'false',
1418
+ 'desc' => __('Switch this on to enable analytics on Instant Article pages.', 'accelerated-mobile-pages'),
1419
+ 'required' => array('fb-instant-article-switch', '=', 1)
1420
+ ),
1421
+ array(
1422
+ 'id' => 'fb-instant-article-analytics-code',
1423
+ 'type' => 'textarea',
1424
+ 'title' => __('Enter your Analytics script code', 'accelerated-mobile-pages'),
1425
+ 'subtitle' => __('Do not enter iframe tag. Find out more about support <a href="https://developers.facebook.com/docs/instant-articles/analytics">here</a> ', 'accelerated-mobile-pages'),
1426
+ 'required' => array('fb-instant-article-analytics', '=', 1)
1427
+ ),
1428
+ ),
1429
+ )
1430
+ );
1431
 
1432
+ // Hide AMP Bulk Tools
1433
+ Redux::setSection( $opt_name, array(
1434
+ 'title' => __( 'Hide AMP Bulk Tools', 'accelerated-mobile-pages' ),
1435
+ 'id' => 'hide-amp-section',
1436
+ 'subsection' => true,
1437
+ 'desc' => 'Here are some Advanced options to help you exclude AMP from your prefered pages',
1438
+ 'fields' => array(
1439
+
1440
+ array(
1441
+ 'id' => 'amp-pages-meta-default',
1442
+ 'type' => 'select',
1443
+ 'title' => __( 'Individual AMP Page (Bulk Edit)', 'accelerated-mobile-pages' ),
1444
+ 'subtitle' => __( 'Allows you to Show or Hide AMP from All pages, so it can be changed individually later. This option will change the Default value of AMP metabox in Pages', 'accelerated-mobile-pages' ),
1445
+ 'desc' => __( 'NOTE: Changes will overwrite the previous settings.', 'accelerated-mobile-pages' ),
1446
+ 'options' => array(
1447
+ 'show' => __('Show by Default', 'accelerated-mobile-pages' ),
1448
+ 'hide' => __('Hide by default', 'accelerated-mobile-pages' ),
1449
+ ),
1450
+ 'default' => 'show',
1451
+ 'required'=>array('amp-on-off-for-all-pages','=','1'),
1452
+ ),
1453
+ array(
1454
+ 'id' =>'hide-amp-categories',
1455
+ 'type' => 'checkbox',
1456
+ 'title' => __('Select Categories to Hide AMP'),
1457
+ 'subtitle' => __( 'Hide AMP from all the posts of a selected category.', 'accelerated-mobile-pages' ),
1458
+ 'default' => 0,
1459
+ 'data' => 'categories',
1460
+ ),
1461
+ )
1462
+ )
1463
+ );
1464
+
1465
+ // Advance Settings SECTION
1466
+ Redux::setSection( $opt_name, array(
1467
+ 'title' => __( 'Advance Settings', 'accelerated-mobile-pages' ),
1468
+ 'desc' => __( 'This section has Advance settings','accelerated-mobile-pages'),
1469
+ 'id' => 'amp-advance',
1470
+ 'subsection' => true,
1471
+ 'fields' => array(
1472
+
1473
+ /* array(
1474
+ 'id' => 'ampforwp-homepage-on-off-support',
1475
+ 'type' => 'switch',
1476
+ 'title' => __('Homepage Support', 'accelerated-mobile-pages'),
1477
+ 'subtitle' => __('Enable/Disable Home page using this switch.', 'accelerated-mobile-pages'),
1478
+ 'default' => '1'
1479
+ ),*/
1480
+
1481
+ array(
1482
+ 'id' => 'amp-mobile-redirection',
1483
+ 'type' => 'switch',
1484
+ 'title' => __('Mobile Redirection', 'accelerated-mobile-pages'),
1485
+ 'subtitle' => __('
1486
+ Enable AMP for your mobile users. Give your visitors a Faster mobile User Experience.','accelerated-mobile-pages'),
1487
+ 'default' => 0,
1488
+
1489
+ ),
1490
+
1491
+ array(
1492
+ 'id' => 'amp-header-text-area-for-html',
1493
+ 'type' => 'textarea',
1494
+ 'title' => __('Enter HTML in Header', 'accelerated-mobile-pages'),
1495
+ 'subtitle' => __('please enter markup that is AMP validated', 'accelerated-mobile-pages'),
1496
+ 'desc' => __('check your markup here (enter markup between HEAD tag) : https://validator.ampproject.org/', 'accelerated-mobile-pages'),
1497
+ 'default' => ''
1498
+ ),
1499
+ array(
1500
+ 'id' => 'amp-footer-text-area-for-html',
1501
+ 'type' => 'textarea',
1502
+ 'title' => __('Enter HTML in Footer', 'accelerated-mobile-pages'),
1503
+ 'subtitle' => __('please enter markup that is AMP validated', 'accelerated-mobile-pages'),
1504
+ 'desc' => __('check your markup here (enter markup between BODY tag) : https://validator.ampproject.org/',
1505
+ 'accelerated-mobile-pages'),
1506
+ 'default' => ''
1507
+ ),
1508
+ array(
1509
+ 'id' => 'ampforwp-auto-amp-menu-link',
1510
+ 'type' => 'switch',
1511
+ 'title' => __('Auto Add AMP in Menu URL', 'accelerated-mobile-pages'),
1512
+ 'subtitle' => __('Automatically add <code>AMP</code> at the end of menu url', 'accelerated-mobile-pages'),
1513
+ 'true' => 'true',
1514
+ 'false' => 'false',
1515
+ 'default' => 0,
1516
+ //'required' => array('ampforwp-amp-menu', '=' , '1')
1517
+ ),
1518
+
1519
+ ),
1520
+
1521
+ ) );
1522
+
1523
+
1524
+ // Translation Panel
1525
+ Redux::setSection( $opt_name, array(
1526
+ 'title' => __( 'Translation Panel', 'accelerated-mobile-pages' ),
1527
+ 'desc' => __( 'Please translate the following words of page accordingly else default content is in English Language', 'accelerated-mobile-pages' ),
1528
+ 'id' => 'amp-translator',
1529
+ 'subsection' => true,
1530
+ 'fields' => array(
1531
+ array(
1532
+ 'id' => 'amp-use-pot',
1533
+ 'type' => 'switch',
1534
+ 'title' => __('Use POT file method of Translation', 'accelerated-mobile-pages'),
1535
+ 'subtitle' => __('Else you can use normal translation method', 'accelerated-mobile-pages'),
1536
+ 'desc' => __('Use this if you want Multilingual Translations', 'accelerated-mobile-pages'),
1537
+ 'default' => 0
1538
+ ),
1539
+ array(
1540
+ 'id' => 'amp-translator-show-more-posts-text',
1541
+ 'type' => 'text',
1542
+ 'title' => __('Show more Posts', 'accelerated-mobile-pages'),
1543
+ 'default' => __('Show more Posts','accelerated-mobile-pages'),
1544
+ 'placeholder'=>__('write here','accelerated-mobile-pages'),
1545
+ 'required' => array( 'amp-use-pot', '=' , 0 )
1546
+ ),
1547
+ array(
1548
+ 'id' => 'amp-translator-show-previous-posts-text',
1549
+ 'type' => 'text',
1550
+ 'title' => __('Show previous Posts', 'accelerated-mobile-pages'),
1551
+ 'default' => __('Show previous Posts','accelerated-mobile-pages'),
1552
+ 'placeholder'=>__('write here','accelerated-mobile-pages'),
1553
+ 'required' => array( 'amp-use-pot', '=' , 0 )
1554
+ ),
1555
+ array(
1556
+ 'id' => 'amp-translator-top-text',
1557
+ 'type' => 'text',
1558
+ 'title' => __('Top', 'accelerated-mobile-pages'),
1559
+ 'default' => __('Top','accelerated-mobile-pages'),
1560
+ 'placeholder'=>__('write here','accelerated-mobile-pages'),
1561
+ 'required' => array( 'amp-use-pot', '=' , 0 )
1562
+ ),
1563
+ array(
1564
+ 'id' => 'amp-translator-non-amp-page-text',
1565
  'type' => 'text',
1566
  'title' => __('View Non-AMP Version', 'accelerated-mobile-pages'),
1567
  'default' => __('View Non-AMP Version','accelerated-mobile-pages'),
1794
  'placeholder'=>__('write here','accelerated-mobile-pages'),
1795
  'required' => array( 'amp-use-pot', '=' , 0 )
1796
 
1797
+ )
1798
+ ) );
1799
+
1800
+
1801
+ // Appearance Section
1802
+ Redux::setSection( $opt_name, array(
1803
+ 'title' => __( 'Appearance', 'accelerated-mobile-pages' ),
1804
+ 'icon' => 'el el-adjust-alt',
1805
+ 'desc' => ''
1806
+
1807
+ ));
1808
+
1809
+ //get All design
1810
+ function amp_extra_plugin_theme_header($headers){
1811
+ $headers['AMP Theme Name'] = "AMP";
1812
+ return $headers;
1813
+ }
1814
+ add_filter("extra_plugin_headers","amp_extra_plugin_theme_header");
1815
+ $themeDesign = array(
1816
+ '1' => __('Design One', 'accelerated-mobile-pages' ),
1817
+ '2' => __('Design Two', 'accelerated-mobile-pages' ),
1818
+ '3' => __('Design Three', 'accelerated-mobile-pages' )
1819
+ );
1820
+ if(count(get_plugins())>0){
1821
+ foreach (get_plugins() as $key => $value) {
1822
+ $plugin = get_plugin_data(WP_PLUGIN_DIR.'/'.$key);
1823
+ if(!empty($plugin['AMP'])){
1824
+ $themeDesign[$value['TextDomain']] = $plugin['AMP'];
1825
+ }
1826
+ }
1827
+ }
1828
+ // Themes Section
1829
+ Redux::setSection( $opt_name, array(
1830
+ 'title' => __( 'Themes', 'accelerated-mobile-pages' ),
1831
+ 'id' => 'amp-theme-settings',
1832
+ 'subsection' => true,
1833
+ 'fields' => array(
1834
+
1835
+ $fields = array(
1836
+ 'id' => 'amp-design-selector',
1837
+ 'type' => 'select',
1838
+ 'title' => __( 'Themes Selector', 'accelerated-mobile-pages' ),
1839
+ 'subtitle' => __( 'Select your design.', 'accelerated-mobile-pages' ),
1840
+ 'desc' => '<a href="https://ampforwp.com/themes/" target="_blank">View More AMP Themes →</a>',
1841
+ 'options' => $themeDesign,
1842
+ 'default' => '2'
1843
+ ),
1844
+
1845
+ $fields = array(
1846
+ 'id' => 'info_theme_framework',
1847
+ 'type' => 'info',
1848
+ 'style' => 'success',
1849
+ 'desc' => $amptfad
1850
+ )
1851
+
1852
+ )
1853
+ ) );
1854
+
1855
+ // Global Theme Settings
1856
+ Redux::setSection($opt_name, array(
1857
+ 'title' => __( 'Global', 'accelerated-mobile-pages' ),
1858
+ 'id' => 'amp-theme-global-subsection',
1859
+ 'subsection' => true,
1860
+ 'fields' => array(
1861
+
1862
+ array(
1863
+ 'id' => 'amp-opt-color-rgba-colorscheme',
1864
+ 'type' => 'color_rgba',
1865
+ 'title' => __('Color Scheme','accelerated-mobile-pages'),
1866
+ 'default' => array(
1867
+ 'color' => '#F42F42',
1868
+ ),
1869
+ 'required' => array(
1870
+ array('amp-design-selector', '=' , '3')
1871
+ )
1872
+ ),
1873
+ array(
1874
+ 'id' => 'amp-opt-color-rgba-font',
1875
+ 'type' => 'color_rgba',
1876
+ 'title' => __('Color Scheme Font Color','accelerated-mobile-pages'),
1877
+ 'default' => array(
1878
+ 'color' => '#fff',
1879
+ ),
1880
+ 'required' => array(
1881
+ array('amp-design-selector', '=' , '3')
1882
+ )
1883
+ ),
1884
+ array(
1885
+ 'id' => 'amp-opt-color-rgba-link',
1886
+ 'type' => 'color_rgba',
1887
+ 'title' => __('Anchor Link Color','accelerated-mobile-pages'),
1888
+ 'default' => array(
1889
+ 'color' => '#f42f42',
1890
+ ),
1891
+ 'required' => array(
1892
+ array('amp-design-selector', '=' , '3')
1893
+ )
1894
+ ),
1895
+
1896
+ // Call Now button
1897
+ array(
1898
+ 'id' => 'ampforwp-callnow-button',
1899
+ 'type' => 'switch',
1900
+ 'title' => __('Call Now Button', 'accelerated-mobile-pages'),
1901
+ 'true' => 'true',
1902
+ 'false' => 'false',
1903
+ 'default' => 0
1904
+ ),
1905
+ array(
1906
+ 'id' =>'enable-amp-call-numberfield',
1907
+ 'type' => 'text',
1908
+ 'required' => array('ampforwp-callnow-button', '=' , '1'),
1909
+ 'title' => __('Enter Phone Number', 'accelerated-mobile-pages'),
1910
+ 'default' => '',
1911
+ ),
1912
+ array(
1913
+ 'id' => 'amp-opt-color-rgba-colorscheme-call',
1914
+ 'type' => 'color_rgba',
1915
+ 'title' => __('Call Button Color','accelerated-mobile-pages'),
1916
+ 'default' => array(
1917
+ 'color' => '#0a89c0',
1918
+ ),
1919
+ 'required' => array(
1920
+ array('ampforwp-callnow-button', '=' , '1')
1921
+ )
1922
+ ),
1923
+
1924
+ array(
1925
+ 'id' => 'amp-design-3-search-feature',
1926
+ 'type' => 'switch',
1927
+ 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
1928
+ 'title' => __( 'Search', 'accelerated-mobile-pages' ),
1929
+ 'required' => array(
1930
+ array('amp-design-selector', '=' , '3')
1931
+ ),
1932
+ 'default' => '0'
1933
+ ),
1934
+
1935
+ array(
1936
+ 'id' => 'amp-design-2-search-feature',
1937
+ 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
1938
+ 'type' => 'switch',
1939
+ 'title' => __( 'Search', 'accelerated-mobile-pages' ),
1940
+ 'required' => array(
1941
+ array('amp-design-selector', '=' , '2')
1942
+ ),
1943
+ 'default' => '0'
1944
+ ),
1945
+
1946
+ array(
1947
+ 'id' => 'amp-design-1-search-feature',
1948
+ 'subtitle' => __('HTTPS is mandatory for Search', 'accelerated-mobile-pages'),
1949
+ 'type' => 'switch',
1950
+ 'title' => __( 'Search', 'accelerated-mobile-pages' ),
1951
+ 'required' => array(
1952
+ array('amp-design-selector', '=' , '1')
1953
+ ),
1954
+ 'default' => '0'
1955
+ ),
1956
+
1957
+ array(
1958
+ 'id' => 'css_editor',
1959
+ 'type' => 'ace_editor',
1960
+ 'title' => __('Custom CSS', 'accelerated-mobile-pages'),
1961
+ 'subtitle' => __('You can customize the Stylesheet of the AMP version by using this option.', 'accelerated-mobile-pages'),
1962
+ 'mode' => 'css',
1963
+ 'theme' => 'monokai',
1964
+ 'desc' => '',
1965
+ 'default' => __('/******* Paste your Custom CSS in this Editor *******/','accelerated-mobile-pages')
1966
+ ),
1967
+ )
1968
+ ));
1969
+
1970
+ // Header Elements default Color
1971
+ function ampforwp_get_element_default_color() {
1972
+ $default_value = get_option('redux_builder_amp', true);
1973
+ $default_value = $default_value['amp-opt-color-rgba-colorscheme']['color'];
1974
+ if ( empty( $default_value ) ) {
1975
+ $default_value = '#333';
1976
+ }
1977
+ return $default_value;
1978
+ }
1979
+
1980
+ // Header Section
1981
+ Redux::setSection( $opt_name, array(
1982
+ 'title' => __( 'Header', 'accelerated-mobile-pages' ),
1983
+ 'id' => 'amp-theme-header-settings',
1984
+ 'subsection' => true,
1985
+ 'fields' => array(
1986
+
1987
+ array(
1988
+ 'id' =>'amp-on-off-support-for-non-amp-home-page',
1989
+ 'type' => 'switch',
1990
+ 'title' => __('Non-AMP HomePage link in Header and Logo', 'accelerated-mobile-pages'),
1991
+ 'subtitle' => __('If you want users in header to go to non-AMP website from the Header, then you can enable this option', 'accelerated-mobile-pages'),
1992
+ 'default' => 0,
1993
+ ),
1994
+ array(
1995
+ 'id' => 'amp-opt-sticky-head',
1996
+ 'type' => 'switch',
1997
+ 'title' => __('Make Header UnSticky','accelerated-mobile-pages'),
1998
+ 'required' => array(
1999
+ array('amp-design-selector', '=' , '3')
2000
+ ),
2001
+ 'desc' => __('Turning it ON will remove the sticky head from the design.', 'accelerated-mobile-pages' ),
2002
+ 'default' => '0'
2003
+ ),
2004
+ array(
2005
+ 'id' => 'amp-opt-color-rgba-headercolor',
2006
+ 'type' => 'color_rgba',
2007
+ 'title' => __('Header Background Color','accelerated-mobile-pages'),
2008
+ 'default' => array(
2009
+ 'color' => '#FFFFFF',
2010
+ ),
2011
+ 'required' => array(
2012
+ array('amp-design-selector', '=' , '3')
2013
+ )
2014
+ ),
2015
+ array(
2016
+ 'id' => 'amp-opt-color-rgba-headerelements',
2017
+ 'type' => 'color_rgba',
2018
+ 'title' => __('Header Elements Color','accelerated-mobile-pages'),
2019
+ 'default' => array(
2020
+ 'color' => ampforwp_get_element_default_color(),
2021
+ ),
2022
+ 'required' => array(
2023
+ array('amp-design-selector', '=' , '3')
2024
+ )
2025
+ ),
2026
+ array(
2027
+ 'id' => 'ampforwp-amp-menu',
2028
+ 'type' => 'switch',
2029
+ 'title' => __('Navigation Menu in AMP', 'accelerated-mobile-pages'),
2030
+ 'desc' => __( 'Add Menus to your AMP pages by clicking on this <a href="'.trailingslashit(get_admin_url()).'nav-menus.php?action=locations">link</a>' , 'accelerated-mobile-pages'),
2031
+ 'subtitle' => __('The switch to Enable/Disable Menu in all AMP Pages', 'accelerated-mobile-pages'),
2032
+ 'true' => 'true',
2033
+ 'false' => 'false',
2034
+ 'default' => 1
2035
+ ),
2036
+
2037
+ )
2038
+ )
2039
+ );
2040
+
2041
+
2042
+ //code for fetching ctegories to show as a list in redux settings
2043
+ $categories = get_categories( array(
2044
+ 'orderby' => 'name',
2045
+ 'order' => 'ASC'
2046
+ ) );
2047
+ $categories_array = array();
2048
+ if ( $categories ) :
2049
+ foreach ($categories as $cat ) {
2050
+ $cat_id = $cat->cat_ID;
2051
+ $key = "".$cat_id;
2052
+ //building assosiative array of ID-cat_name
2053
+ $categories_array[ $key ] = $cat->name;
2054
+ }
2055
+ endif;
2056
+ //End of code for fetching ctegories to show as a list in redux settings
2057
+
2058
+ // HomePage Section
2059
+ Redux::setSection( $opt_name, array(
2060
+ 'title' => __( 'HomePage', 'accelerated-mobile-pages' ),
2061
+ 'id' => 'amp-theme-homepage-settings',
2062
+ 'subsection' => true,
2063
+ 'fields' => array(
2064
+
2065
+ // Excerpt Length #1013
2066
+ array(
2067
+ 'id' =>'amp-design-1-excerpt',
2068
+ 'type' =>'text',
2069
+ 'subtitle' =>__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
2070
+ 'title' =>__('Excerpt Length','accelerated-mobile-pages'),
2071
+ 'required' => array(
2072
+ array('amp-design-selector', '=' , '1')
2073
+ ),
2074
+ 'validate' =>'numeric',
2075
+ 'default' =>'20',
2076
+ ),
2077
+
2078
+ // Homepage thumbnail
2079
+
2080
+ array(
2081
+ 'id' => 'ampforwp-homepage-posts-image-modify-size',
2082
+ 'type' => 'switch',
2083
+ 'title' => __('Override Homepage Thumbnail Size', 'accelerated-mobile-pages'),
2084
+ 'default' => 0,
2085
+ 'required' => array(
2086
+ array('amp-design-selector','!=',3)
2087
+ )
2088
+ ),
2089
+ array(
2090
+ 'id' => 'ampforwp-homepage-posts-design-1-2-width',
2091
+ 'type' => 'text',
2092
+ 'title' => __('Image Width', 'accelerated-mobile-pages'),
2093
+ 'subtitle' => __('Defaults to 100', 'accelerated-mobile-pages'),
2094
+ 'default' => 100,
2095
+ 'required' => array(
2096
+ array('amp-design-selector','!=',3),
2097
+ array('ampforwp-homepage-posts-image-modify-size','=',1)
2098
+ )
2099
+ ),
2100
+ array(
2101
+ 'id' => 'ampforwp-homepage-posts-design-1-2-height',
2102
+ 'type' => 'text',
2103
+ 'title' => __('Image Height', 'accelerated-mobile-pages'),
2104
+ 'subtitle' => __('Defaults to 75', 'accelerated-mobile-pages'),
2105
+ 'default' => 75,
2106
+ 'required' => array(
2107
+ array('amp-design-selector','!=',3),
2108
+ array('ampforwp-homepage-posts-image-modify-size','=',1)
2109
+ )
2110
+ ),
2111
+ array(
2112
+ 'id' => 'ampforwp-homepage-posts-design-3-width',
2113
+ 'type' => 'text',
2114
+ 'title' => __('Image Width', 'accelerated-mobile-pages'),
2115
+ 'subtitle' => __('Defaults to 450', 'accelerated-mobile-pages'),
2116
+ 'default' => 330,
2117
+ 'required' => array(
2118
+ array('amp-design-selector','=',3),
2119
+ array('ampforwp-homepage-posts-image-modify-size','=',1)
2120
+ )
2121
+ ),
2122
+ array(
2123
+ 'id' => 'ampforwp-homepage-posts-design-3-height',
2124
+ 'type' => 'text',
2125
+ 'title' => __('Image Height', 'accelerated-mobile-pages'),
2126
+ 'subtitle' => __('Defaults to 270', 'accelerated-mobile-pages'),
2127
+ 'default' => 198,
2128
+ 'required' => array(
2129
+ array('amp-design-selector','=',3),
2130
+ array('ampforwp-homepage-posts-image-modify-size','=',1)
2131
+ )
2132
+ ),
2133
+
2134
+ array(
2135
+ 'id' => 'amp-design-3-featured-slider',
2136
+ 'type' => 'switch',
2137
+ 'title' => __( 'Featured Slider', 'accelerated-mobile-pages' ),
2138
+ 'required' => array(
2139
+ array('amp-design-selector', '=' , '3')
2140
+ ),
2141
+ 'default' => '1'
2142
+ ),
2143
+ array(
2144
+ 'id' => 'amp-design-3-category-selector',
2145
+ 'type' => 'select',
2146
+ 'title' => __( 'Featured Slider Category', 'accelerated-mobile-pages' ),
2147
+ 'options' => $categories_array,
2148
+ 'required' => array(
2149
+ array('amp-design-selector', '=' , '3'),
2150
+ array('amp-design-3-featured-slider', '=' , '1')
2151
+ ),
2152
+ ),
2153
+ )
2154
+ ));
2155
+
2156
+ // Single Section
2157
+ Redux::setSection( $opt_name, array(
2158
+ 'title' => __( 'Single', 'accelerated-mobile-pages' ),
2159
+ // 'desc' => __( 'Additional Options to control the look of Single <a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'"> Click here </a> ', 'accelerated-mobile-pages' ),
2160
+ 'id' => 'amp-single',
2161
+ 'subsection' => true,
2162
+ 'fields' => array(
2163
+ // Social Icons ON/OFF
2164
+ array(
2165
+ 'id' => 'enable-single-social-icons',
2166
+ 'type' => 'switch',
2167
+ 'title' => __('Sticky Social Icons', 'accelerated-mobile-pages'),
2168
+ 'default' => 1,
2169
+ 'subtitle' => __('Enable Social Icons in single', 'accelerated-mobile-pages'),
2170
+ ),
2171
+ // Excerpt ON/OFF
2172
+ array(
2173
+ 'id' => 'enable-excerpt-single',
2174
+ 'type' => 'switch',
2175
+ 'title' => __('Excerpt in single', 'accelerated-mobile-pages'),
2176
+ 'default' => 0,
2177
+ 'subtitle' => __('Enable feature to add Excerpt above Content in single', 'accelerated-mobile-pages'),
2178
+ ),
2179
+ //deselectable next previous links
2180
+ array(
2181
+ 'id' => 'enable-single-next-prev',
2182
+ 'type' => 'switch',
2183
+ 'title' => __('Next-Previous Links', 'accelerated-mobile-pages'),
2184
+ 'default' => 1,
2185
+ 'subtitle' => __('Enable Next-Previous links in single', 'accelerated-mobile-pages'),
2186
+ ),
2187
+ // Post Modified Date
2188
+ array(
2189
+ 'id' => 'post-modified-date',
2190
+ 'type' => 'switch',
2191
+ 'title' => __('Show Post Modified Date', 'accelerated-mobile-pages'),
2192
+ 'default' => 0,
2193
+ 'subtitle' => __('Show Modified date of an article at the end of the post.', 'accelerated-mobile-pages'),
2194
+ ),
2195
+ // Author Bio
2196
+ array(
2197
+ 'id' => 'amp-author-description',
2198
+ 'type' => 'switch',
2199
+ 'title' => __( 'Author Bio in Single', 'accelerated-mobile-pages' ),
2200
+ 'default' => '1',
2201
+ ),
2202
+ // Date on Single
2203
+ array(
2204
+ 'id' => 'amp-design-3-date-feature',
2205
+ 'type' => 'switch',
2206
+ 'title' => __( 'Display Date on Single', 'accelerated-mobile-pages' ),
2207
+ 'required' => array(
2208
+ array('amp-design-selector', '=' , '3')
2209
+ ),
2210
+ 'desc' => __('Display date along with author and category', 'accelerated-mobile-pages' ),
2211
+ 'default' => '0'
2212
+ ),
2213
+ // Pagination //#1015
2214
+ array(
2215
+ 'id' => 'amp-pagination',
2216
+ 'type' => 'switch',
2217
+ 'title' => __( 'Pagination in Single', 'accelerated-mobile-pages' ),
2218
+ 'default' => 0,
2219
+ 'subtitle' => __('Enable the feature to add Pagination in single', 'accelerated-mobile-pages'),
2220
+ ),
2221
+ // Related Post
2222
+ array(
2223
+ 'id' => 'ampforwp-single-select-type-of-related',
2224
+ 'type' => 'select',
2225
+ 'title' => __('Show Related Post from', 'accelerated-mobile-pages'),
2226
+ 'data' => 'page',
2227
+ 'subtitle' => __('select the type of related posts', 'accelerated-mobile-pages'),
2228
+ 'options' => array(
2229
+ '1' => 'Tags',
2230
+ '2' => 'Categories'
2231
+ ),
2232
+ 'default' => '2',
2233
+ ),
2234
+ array(
2235
+ 'id' => 'ampforwp-number-of-related-posts',
2236
+ 'type' => 'text',
2237
+ 'title' => __('Number of Related Post', 'accelerated-mobile-pages'),
2238
+ 'subtitle' => __('Type the number of related posts you need, Eg : 2', 'accelerated-mobile-pages'),
2239
+ 'validate' => 'numeric',
2240
+ 'default' => '3',
2241
+ ),
2242
+
2243
+ // array(
2244
+ // 'id' => 'ampforwp-comments-banner',
2245
+ // 'type' => 'select',
2246
+ // 'desc' => $comment_desc,
2247
+ // 'title' => __(' df', 'accelerated-mobile-pages'),
2248
+ // 'class' => 'new-class',
2249
+ //
2250
+ // // 'desc' => ' <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
2251
+ // ),
2252
+ //
2253
+ $fields = array(
2254
+ 'id' => 'info_normal',
2255
+ 'type' => 'info',
2256
+ 'class' => 'extension_banner_bg',
2257
+ 'desc' => $single_extension_listing )
2258
+
2259
+ ),
2260
+
2261
+ ) );
2262
 
2263
+ // Footer Section
2264
+ Redux::setSection( $opt_name, array(
2265
+ 'title' => __( 'Footer', 'accelerated-mobile-pages' ),
2266
+ 'id' => 'amp-theme-footer-settings',
2267
+ 'subsection' => true,
2268
+ 'fields' => array(
2269
+
2270
+ array(
2271
+ 'id' => 'amp-footer-link-non-amp-page',
2272
+ 'type' => 'switch',
2273
+ 'title' => __('Link to Non-AMP page in Footer', 'accelerated-mobile-pages'),
2274
+ 'subtitle' => __('Enable / Disable Link to Non-AMP page in the footer', 'accelerated-mobile-pages'),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2275
  'true' => 'true',
2276
  'false' => 'false',
2277
+ 'default' => 1
2278
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2279
 
2280
+ array(
2281
+ 'id' => 'amp-design-3-credit-link',
2282
+ 'type' => 'switch',
2283
+ 'title' => __( 'Credit link', 'accelerated-mobile-pages' ),
2284
+ 'required' => array(
2285
+ array('amp-design-selector', '=' , '3')
2286
+ ),
2287
+ 'default' => '1'
2288
+ ),
2289
+ )
2290
+ ));
 
 
 
 
 
 
 
 
 
 
 
 
 
2291
 
2292
+ // Page Section
2293
+ Redux::setSection( $opt_name, array(
2294
+ 'title' => __( 'Page', 'accelerated-mobile-pages' ),
2295
+ 'id' => 'amp-theme-page-settings',
2296
+ 'subsection' => true,
2297
+ 'fields' => array(
2298
+ /* // Pages Separator
2299
+ array(
2300
+ 'id' => 'Page',
2301
+ 'type' => 'section',
2302
+ 'title' => __('Pages', 'accelerated-mobile-pages'),
2303
+ 'indent' => true,
2304
+ ),*/
2305
+ // Meta ON/OFF Pages
2306
+ array(
2307
+ 'id' => 'meta_page',
2308
+ 'type' => 'switch',
2309
+ 'default' => '0',
2310
+ 'title' => __('Meta For Pages', 'accelerated-mobile-pages'),
2311
+ 'subtitle' => __('Enable or disable the Meta on Pages'),
2312
+ ),
2313
+ )
2314
+ ));
2315
+
2316
+ // Social Section
2317
+ Redux::setSection( $opt_name, array(
2318
+ 'title' => __( 'Social', 'accelerated-mobile-pages' ),
2319
+ 'id' => 'amp-social',
2320
+ 'desc' => __('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
2321
+ 'subsection' => true,
2322
+ 'fields' => array(
2323
+ // Facebook ON/OFF
2324
+ array(
2325
+ 'id' => 'enable-single-facebook-share',
2326
+ 'type' => 'switch',
2327
+ //'required' => array('enable-single-social-icons', '=' , '1'),
2328
+ 'title' => __('Facebook', 'accelerated-mobile-pages'),
2329
+ 'default' => 0,
2330
+ ),
2331
+ // Facebook app ID
2332
+ array(
2333
+ 'id' => 'amp-facebook-app-id',
2334
+ 'title' => __('Facebook App ID', 'accelerated-mobile-pages'),
2335
+ 'subtitle' => __('In order to use Facebook share you need to register an app ID, you can register one here: https://developers.facebook.com/apps.', 'accelerated-mobile-pages'),
2336
+ 'type' => 'text',
2337
+ 'required' => array('enable-single-facebook-share', '=' , '1'),
2338
+ 'placeholder' => __('Enter your facebook app id','accelerated-mobile-pages'),
2339
+ 'default' => ''
2340
+ ),
2341
+ // Twitter ON/OFF
2342
+ array(
2343
+ 'id' => 'enable-single-twitter-share',
2344
+ 'type' => 'switch',
2345
+ 'title' => __('Twitter', 'accelerated-mobile-pages'),
2346
+ 'default' => 1,
2347
+ ),
2348
+ array(
2349
+ 'id' => 'enable-single-twitter-share-handle',
2350
+ 'type' => 'text',
2351
+ 'title' => __('Twitter Handle', 'accelerated-mobile-pages'),
2352
+ 'required' => array('enable-single-twitter-share', '=' , '1'),
2353
+ 'placeholder' => __('Eg: @xyx','accelerated-mobile-pages'),
2354
+ 'default' => '',
2355
+ ),
2356
+ // GooglePlus ON/OFF
2357
+ array(
2358
+ 'id' => 'enable-single-gplus-share',
2359
+ 'type' => 'switch',
2360
+ 'title' => __('GooglePlus', 'accelerated-mobile-pages'),
2361
+ 'default' => 1,
2362
+ ),
2363
+ // Email ON/OFF
2364
+ array(
2365
+ 'id' => 'enable-single-email-share',
2366
+ 'type' => 'switch',
2367
+ 'title' => __('Email', 'accelerated-mobile-pages'),
2368
+ 'default' => 1,
2369
+ ),
2370
+ // Pinterest ON/OFF
2371
+ array(
2372
+ 'id' => 'enable-single-pinterest-share',
2373
+ 'type' => 'switch',
2374
+ 'title' => __('Pinterest', 'accelerated-mobile-pages'),
2375
+ 'default' => 1,
2376
+ ),
2377
+ // LinkedIn ON/OFF
2378
+ array(
2379
+ 'id' => 'enable-single-linkedin-share',
2380
+ 'type' => 'switch',
2381
+ 'title' => __('LinkedIn', 'accelerated-mobile-pages'),
2382
+ 'default' => 1,
2383
+ ),
2384
+ // WhatsApp
2385
+ array(
2386
+ 'id' => 'enable-single-whatsapp-share',
2387
+ 'type' => 'switch',
2388
+ 'title' => __('WhatsApp', 'accelerated-mobile-pages'),
2389
+ 'default' => 1,
2390
+ ),
2391
+ // LINE
2392
+ array(
2393
+ 'id' => 'enable-single-line-share',
2394
+ 'type' => 'switch',
2395
+ 'title' => __('LINE', 'accelerated-mobile-pages'),
2396
+ 'default' => 1,
2397
+ ),
2398
+ array(
2399
+ 'id' => 'social-media-profiles-subsection',
2400
+ 'type' => 'section',
2401
+ 'title' => __('Social Media Profiles (Design #3)', 'accelerated-mobile-pages'),
2402
+ 'subtitle' => __('Please enter your personal/organizational social media profiles here', 'accelerated-mobile-pages'),
2403
+ 'indent' => true,
2404
+ 'required' => array(
2405
+ array('amp-design-selector', '=' , '3')
2406
+ ),
2407
+ ),
2408
+ //#1
2409
+ array(
2410
+ 'id' => 'enable-single-twittter-profile',
2411
+ 'type' => 'switch',
2412
+ 'title' => __('Twitter ', 'accelerated-mobile-pages'),
2413
+ 'default' => 1,
2414
+ 'required' => array(
2415
+ array('amp-design-selector', '=' , '3')
2416
+ ),
2417
+ ),
2418
+ array(
2419
+ 'id' => 'enable-single-twittter-profile-url',
2420
+ 'type' => 'text',
2421
+ 'title' => __('Twitter URL', 'accelerated-mobile-pages'),
2422
+ 'default' => '#',
2423
+ 'required' => array(
2424
+ array('amp-design-selector', '=' , '3'),
2425
+ array('enable-single-twittter-profile', '=' , '1')
2426
+ ),
2427
+ ),
2428
+ //#2
2429
+ array(
2430
+ 'id' => 'enable-single-facebook-profile',
2431
+ 'type' => 'switch',
2432
+ 'title' => __('Facebook ', 'accelerated-mobile-pages'),
2433
+ 'default' => 1,
2434
+ 'required' => array(
2435
+ array('amp-design-selector', '=' , '3')
2436
+ ),
2437
+ ),
2438
+ array(
2439
+ 'id' => 'enable-single-facebook-profile-url',
2440
+ 'type' => 'text',
2441
+ 'title' => __('Facebook URL', 'accelerated-mobile-pages'),
2442
+ 'default' => '#',
2443
+ 'required' => array(
2444
+ array('amp-design-selector', '=' , '3'),
2445
+ array('enable-single-facebook-profile', '=' , '1')
2446
+ ),
2447
+ ),
2448
+ //#3
2449
+ array(
2450
+ 'id' => 'enable-single-pintrest-profile',
2451
+ 'type' => 'switch',
2452
+ 'title' => __('Pintrest ', 'accelerated-mobile-pages'),
2453
+ 'default' => 1,
2454
+ 'required' => array(
2455
+ array('amp-design-selector', '=' , '3')
2456
+ ),
2457
+ ),
2458
+ array(
2459
+ 'id' => 'enable-single-pintrest-profile-url',
2460
+ 'type' => 'text',
2461
+ 'title' => __('Pintrest URL', 'accelerated-mobile-pages'),
2462
+ 'default' => '#',
2463
+ 'required' => array(
2464
+ array('amp-design-selector', '=' , '3'),
2465
+ array('enable-single-pintrest-profile', '=' , '1')
2466
+ ),
2467
+ ),
2468
+ //#4
2469
+ array(
2470
+ 'id' => 'enable-single-google-plus-profile',
2471
+ 'type' => 'switch',
2472
+ 'title' => __('Google Plus ', 'accelerated-mobile-pages'),
2473
+ 'default' => 0,
2474
+ 'required' => array(
2475
+ array('amp-design-selector', '=' , '3')
2476
+ ),
2477
+ ),
2478
+ array(
2479
+ 'id' => 'enable-single-google-plus-profile-url',
2480
+ 'type' => 'text',
2481
+ 'title' => __('Google Plus URL', 'accelerated-mobile-pages'),
2482
+ 'default' => '',
2483
+ 'required' => array(
2484
+ array('amp-design-selector', '=' , '3'),
2485
+ array('enable-single-google-plus-profile', '=' , '1')
2486
+ ),
2487
+ ),
2488
+ //#5
2489
+ array(
2490
+ 'id' => 'enable-single-linkdin-profile',
2491
+ 'type' => 'switch',
2492
+ 'title' => __('Linkdin ', 'accelerated-mobile-pages'),
2493
+ 'default' => 0,
2494
+ 'required' => array(
2495
+ array('amp-design-selector', '=' , '3')
2496
+ ),
2497
+ ),
2498
+ array(
2499
+ 'id' => 'enable-single-linkdin-profile-url',
2500
+ 'type' => 'text',
2501
+ 'title' => __('Linkdin URL', 'accelerated-mobile-pages'),
2502
+ 'default' => '',
2503
+ 'required' => array(
2504
+ array('amp-design-selector', '=' , '3'),
2505
+ array('enable-single-linkdin-profile', '=' , '1')
2506
+ ),
2507
+ ),
2508
+ //#6
2509
+ array(
2510
+ 'id' => 'enable-single-youtube-profile',
2511
+ 'type' => 'switch',
2512
+ 'title' => __('Youtube ', 'accelerated-mobile-pages'),
2513
+ 'default' => 1,
2514
+ 'required' => array(
2515
+ array('amp-design-selector', '=' , '3')
2516
+ ),
2517
+ ),
2518
+ array(
2519
+ 'id' => 'enable-single-youtube-profile-url',
2520
+ 'type' => 'text',
2521
+ 'default' => '#',
2522
+ 'title' => __('Youtube URL', 'accelerated-mobile-pages'),
2523
+ 'required' => array(
2524
+ array('amp-design-selector', '=' , '3'),
2525
+ array('enable-single-youtube-profile', '=' , '1')
2526
+ ),
2527
+ ),
2528
+ //#7
2529
+ array(
2530
+ 'id' => 'enable-single-instagram-profile',
2531
+ 'type' => 'switch',
2532
+ 'title' => __('Instagram ', 'accelerated-mobile-pages'),
2533
+ 'default' => 0,
2534
+ 'required' => array(
2535
+ array('amp-design-selector', '=' , '3')
2536
+ ),
2537
+ ),
2538
+ array(
2539
+ 'id' => 'enable-single-instagram-profile-url',
2540
+ 'type' => 'text',
2541
+ 'default' => '',
2542
+ 'title' => __('Instagram URL', 'accelerated-mobile-pages'),
2543
+ 'required' => array(
2544
+ array('amp-design-selector', '=' , '3'),
2545
+ array('enable-single-instagram-profile', '=' , '1')
2546
+ ),
2547
+ ),
2548
+ //#8
2549
+ array(
2550
+ 'id' => 'enable-single-VKontakte-profile',
2551
+ 'type' => 'switch',
2552
+ 'title' => __('VKontakte ', 'accelerated-mobile-pages'),
2553
+ 'default' => 0,
2554
+ 'required' => array(
2555
+ array('amp-design-selector', '=' , '3')
2556
+ ),
2557
+ ),
2558
+ array(
2559
+ 'id' => 'enable-single-VKontakte-profile-url',
2560
+ 'type' => 'text',
2561
+ 'default' => '',
2562
+ 'title' => __('VKontakte URL', 'accelerated-mobile-pages'),
2563
+ 'required' => array(
2564
+ array('amp-design-selector', '=' , '3'),
2565
+ array('enable-single-VKontakte-profile', '=' , '1')
2566
+ ),
2567
+ ),
2568
+ //#9
2569
+ //removed whatsapp
2570
+ //#10
2571
+ array(
2572
+ 'id' => 'enable-single-reddit-profile',
2573
+ 'type' => 'switch',
2574
+ 'title' => __('Reddit', 'accelerated-mobile-pages'),
2575
+ 'default' => 0,
2576
+ 'required' => array(
2577
+ array('amp-design-selector', '=' , '3')
2578
+ ),
2579
+ ),
2580
+ array(
2581
+ 'id' => 'enable-single-reddit-profile-url',
2582
+ 'type' => 'text',
2583
+ 'title' => __('Reddit URL', 'accelerated-mobile-pages'),
2584
+ 'default' => '',
2585
+ 'required' => array(
2586
+ array('amp-design-selector', '=' , '3'),
2587
+ array('enable-single-reddit-profile', '=' , '1')
2588
+ ),
2589
+ ),
2590
+ //#11
2591
+ array(
2592
+ 'id' => 'enable-single-snapchat-profile',
2593
+ 'type' => 'switch',
2594
+ 'title' => __('Snapchat ', 'accelerated-mobile-pages'),
2595
+ 'default' => 0,
2596
+ 'required' => array(
2597
+ array('amp-design-selector', '=' , '3')
2598
+ ),
2599
+ ),
2600
+ array(
2601
+ 'id' => 'enable-single-snapchat-profile-url',
2602
+ 'type' => 'text',
2603
+ 'title' => __('Snapchat URL', 'accelerated-mobile-pages'),
2604
+ 'default' => '',
2605
+ 'required' => array(
2606
+ array('amp-design-selector', '=' , '3'),
2607
+ array('enable-single-snapchat-profile', '=' , '1')
2608
+ ),
2609
+ ),
2610
+ //#12
2611
+ array(
2612
+ 'id' => 'enable-single-Tumblr-profile',
2613
+ 'type' => 'switch',
2614
+ 'title' => __('Tumblr', 'accelerated-mobile-pages'),
2615
+ 'default' => 0,
2616
+ 'required' => array(
2617
+ array('amp-design-selector', '=' , '3')
2618
+ ),
2619
+ ),
2620
+ array(
2621
+ 'id' => 'enable-single-Tumblr-profile-url',
2622
+ 'type' => 'text',
2623
+ 'title' => __('Tumblr URL', 'accelerated-mobile-pages'),
2624
+ 'default' => '',
2625
+ 'required' => array(
2626
+ array('amp-design-selector', '=' , '3'),
2627
+ array('enable-single-Tumblr-profile', '=' , '1')
2628
+ ),
2629
+ ),
2630
+ )
2631
+ ) );
2632
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2633
 
2634
+ // Misc SECTION
2635
+ Redux::setSection( $opt_name, array(
2636
+ 'title' => __( 'Misc', 'accelerated-mobile-pages' ),
2637
+ 'desc' => '
2638
+ <br /><a href="' . esc_url(admin_url('customize.php?autofocus[section]=amp_design&customize_amp=1')) .'" target="_blank"><img class="ampforwp-post-builder-img" src="'.AMPFORWP_IMAGE_DIR . '/amp-post-builder.png" width="489" height="72" /></a>',
2639
+ 'id' => 'amp-design',
2640
+ 'subsection' => true,
2641
+ 'fields' => array(
2642
 
2643
+ // RTL
2644
+ array(
2645
  'id' =>'amp-rtl-select-option',
2646
  'type' => 'switch',
2647
  'title' => __('RTL Support', 'accelerated-mobile-pages'),
2650
  'true' => 'true',
2651
  'false' => 'false',
2652
  ),
2653
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2654
 
2655
+ ) );
2656
 
2657
+
2658
+
2659
  // Extension Section
2660
  Redux::setSection( $opt_name, array(
2661
  'title' => __( 'Extensions', 'accelerated-mobile-pages' ),
2663
  'id' => 'opt-go-premium',
2664
  'subsection' => false,
2665
  'desc' => $extension_listing,
2666
+ 'icon' => 'el el-puzzle',
2667
  // 'desc' => '<a href="http://ampforwp.com/advanced-amp-ads/#utm_source=options-panel&utm_medium=extension-tab_advanced-amp-ads&utm_campaign=AMP%20Plugin" target="_blank"><img class="ampforwp-extension-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-ads-extension.png" width="345" height="500" /></a>
2668
  //
2669
  // <a href="http://ampforwp.com/custom-post-type/#utm_source=options-panel&utm_medium=extension-tab_custom-post-type&utm_campaign=AMP%20Plugin" target="_blank"><img class="ampforwp-extension-ad-img-banner" src="'.AMPFORWP_IMAGE_DIR . '/amp-custom-post-type-extension.png" width="345" height="500" /></a>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
- Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.8.1
7
- Stable tag: 0.9.60
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,13 +82,14 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
82
  * RTL Support
83
  * Custom AMP FrontPage
84
  * Notifications
85
- * Chartbeat (NEW), Hi-stats (NEW), Yandex Metrika (NEW), Piwik, Segment.com, StatCounter, Effective Measure and comScore Support
86
  * Incontent & DoubleClick Support
87
  * Great Support & Active Development.
88
  * Widgets & WooCommerce
89
  * Genesis SEO Support
90
- * NEW - Breadcrumb Support added
91
- * NEW - Facebook Instant Articles Support Added
 
92
 
93
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
94
 
@@ -142,6 +143,14 @@ You can contact me using this url: http://ampforwp.com/contact/
142
 
143
  == Changelog ==
144
 
 
 
 
 
 
 
 
 
145
  = 0.9.60 (4th September 2017) =
146
  * View more details on https://ampforwp.com/0-9-60-released-improved-redirection-66th-update/
147
  * Class added to View non-amp anchor tag
1
  === AMP for WP - Accelerated Mobile Pages ===
2
  Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
+ Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 4.8.1
7
+ Stable tag: 0.9.61
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  * RTL Support
83
  * Custom AMP FrontPage
84
  * Notifications
85
+ * Chartbeat, Hi-stats, Yandex Metrika, Piwik, Segment.com, StatCounter, Effective Measure and comScore Support
86
  * Incontent & DoubleClick Support
87
  * Great Support & Active Development.
88
  * Widgets & WooCommerce
89
  * Genesis SEO Support
90
+ * Breadcrumb Support added
91
+ * Facebook Instant Articles Support Added
92
+ * NEW - AMP Theme Framework Core Support Added. You can now create AMP templates of your own in just minutes. **[More](https://ampforwp.com/amp-theme-framework/)**
93
 
94
  **[JOIN CHAT GROUP COMMUNITY](http://ampforwp.com/community/)**: Purpose of this group is to get proper suggestions and feedback from plugin users and the community so that we can make the plugin even better.
95
 
143
 
144
  == Changelog ==
145
 
146
+ = 0.9.61 (10th September 2017) =
147
+ * View more details on https://ampforwp.com/options-restructured/
148
+ * Options Panel Restructured – Options were dividing into two parts: Settings and Appearance.
149
+ * AMP Theme Framework Core Support Added. You can now create themes of your own in just minutes.
150
+ * WPML Static Front Page Support #1111
151
+ * Notification message disables when CF7 & gravity form is activated. #1107
152
+ * Space after On in Design 3 #1114
153
+
154
  = 0.9.60 (4th September 2017) =
155
  * View more details on https://ampforwp.com/0-9-60-released-improved-redirection-66th-update/
156
  * Class added to View non-amp anchor tag
templates/design-manager.php CHANGED
@@ -89,7 +89,25 @@ function ampforwp_stylesheet_file_insertion() {
89
  }
90
 
91
  // Add StyleSheet
92
- require AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  }
94
 
95
  // Post Title
89
  }
90
 
91
  // Add StyleSheet
92
+ if(file_exists(AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php')){
93
+ require AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. $ampforwp_design_selector . '/style.php';
94
+ }else{
95
+
96
+ $pluginData = get_plugins();
97
+ if(count($pluginData)>0){
98
+ foreach($pluginData as $key=>$data){
99
+ if($data['TextDomain']==$ampforwp_design_selector){
100
+ if(!file_exists(AMPFORWP_MAIN_PLUGIN_DIR."/".$key)){
101
+ echo "plugin theme not exists";
102
+ }
103
+ break;
104
+ }
105
+ }
106
+ }
107
+ require AMPFORWP_PLUGIN_DIR."/components/theme-loader.php";
108
+
109
+
110
+ }
111
  }
112
 
113
  // Post Title
templates/design-manager/design-1/frontpage.php CHANGED
@@ -1,5 +1,12 @@
1
  <?php global $redux_builder_amp,$wp;
2
- $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
 
 
 
 
 
 
 
3
  $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
1
  <?php global $redux_builder_amp,$wp;
2
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
+ $post_id = get_option('page_on_front');
5
+
6
+ }
7
+ else{
8
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
9
+ }
10
  $template = new AMP_Post_Template( $post_id );?>
11
  <!doctype html>
12
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
templates/design-manager/design-2/frontpage.php CHANGED
@@ -1,5 +1,12 @@
1
  <?php global $redux_builder_amp , $wp;
2
- $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
 
 
 
 
 
 
 
3
  $template = new AMP_Post_Template( $post_id );?>
4
  <!doctype html>
5
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
1
  <?php global $redux_builder_amp , $wp;
2
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
3
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
4
+ $post_id = get_option('page_on_front');
5
+
6
+ }
7
+ else{
8
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
9
+ }
10
  $template = new AMP_Post_Template( $post_id );?>
11
  <!doctype html>
12
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
templates/design-manager/design-3/elements/meta-info.php CHANGED
@@ -35,7 +35,7 @@
35
  <?php endif; ?>
36
 
37
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
38
- <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On '); the_modified_date( get_option( 'date_format' ) ) ?></span>
39
  <?php endif; ?>
40
 
41
  </div>
35
  <?php endif; ?>
36
 
37
  <?php if ( $redux_builder_amp['amp-design-3-date-feature'] ) : ?>
38
+ <span class="ampforwp-design3-single-date"><?php global $redux_builder_amp; echo ampforwp_translation($redux_builder_amp['amp-translator-on-text']. ' ', 'On'); the_modified_date( get_option( 'date_format' ) ) ?></span>
39
  <?php endif; ?>
40
 
41
  </div>
templates/design-manager/design-3/frontpage.php CHANGED
@@ -1,6 +1,14 @@
1
  <?php global $redux_builder_amp;
2
  global $wp;
3
- $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
 
 
 
 
 
 
 
 
4
  $template = new AMP_Post_Template( $post_id );?>
5
  <!doctype html>
6
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
1
  <?php global $redux_builder_amp;
2
  global $wp;
3
+ //WPML Static Front Page Support #1111
4
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
5
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
6
+ $post_id = get_option('page_on_front');
7
+
8
+ }
9
+ else{
10
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
11
+ }
12
  $template = new AMP_Post_Template( $post_id );?>
13
  <!doctype html>
14
  <html amp <?php echo AMP_HTML_Utils::build_attributes_string( $this->get( 'html_tag_attributes' ) ); ?>>
templates/features.php CHANGED
@@ -3331,6 +3331,23 @@ function ampforwp_rel_canonical_home_archive(){
3331
  } ?>
3332
  <link rel="canonical" href="<?php echo user_trailingslashit($amp_url) ?>">
3333
  <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3334
 
3335
  }
3336
 
3331
  } ?>
3332
  <link rel="canonical" href="<?php echo user_trailingslashit($amp_url) ?>">
3333
  <?php }
3334
+
3335
+ if(is_search()){
3336
+ $paged = get_query_var( 'paged' );
3337
+ $current_search_url = trailingslashit(get_home_url())."?s=".get_search_query();
3338
+ $amp_url = untrailingslashit($current_search_url);
3339
+ if ($paged > 1 ) {
3340
+ global $wp;
3341
+ $current_archive_url = home_url( $wp->request );
3342
+ $amp_url = trailingslashit($current_archive_url);
3343
+ $remove = '/'. AMPFORWP_AMP_QUERY_VAR;
3344
+ $amp_url = str_replace($remove, '', $amp_url) ;
3345
+ $amp_url = $amp_url ."?s=".get_search_query();
3346
+ }
3347
+ ?>
3348
+ <link rel="canonical" href="<?php echo user_trailingslashit($amp_url) ?>">
3349
+ <?php
3350
+ }
3351
 
3352
  }
3353
 
templates/frontpage-elements.php CHANGED
@@ -26,6 +26,12 @@ function ampforwp_frontpage_file() {
26
  // Design #1
27
  function ampforwp_design_1_frontpage_content( $template, $post_id ){
28
  global $redux_builder_amp;
 
 
 
 
 
 
29
  $amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
30
 
31
  <article class="amp-wp-article">
@@ -92,6 +98,12 @@ function ampforwp_design_1_frontpage_content( $template, $post_id ){
92
  // Design #2
93
  function ampforwp_design_2_frontpage_content($template, $post_id){
94
  global $redux_builder_amp;
 
 
 
 
 
 
95
  $amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
96
 
97
  <main>
@@ -145,6 +157,12 @@ function ampforwp_design_2_frontpage_content($template, $post_id){
145
  // Design #3
146
  function ampforwp_design_3_frontpage_content($template, $post_id){
147
  global $redux_builder_amp;
 
 
 
 
 
 
148
  $amp_custom_content_enable = get_post_meta( $post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
149
  <main>
150
  <div class="amp-wp-content the_content">
@@ -196,10 +214,22 @@ function ampforwp_design_3_frontpage_content($template, $post_id){
196
  // Frontpage Title for Design #2
197
  function ampforwp_design_2_frontpage_title() {
198
  global $redux_builder_amp;
 
 
 
 
 
 
199
  if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
200
  <header class="amp-wp-article-header ampforwp-title">
201
  <h1 class="amp-wp-title">
202
- <?php $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
 
 
 
 
 
 
203
  echo get_the_title( $ID ) ; ?>
204
  </h1>
205
  </header>
@@ -209,10 +239,24 @@ function ampforwp_design_2_frontpage_title() {
209
  // Frontpage Title for Design #3
210
  function ampforwp_design_3_frontpage_title() {
211
  global $redux_builder_amp;
 
 
 
 
 
 
212
  if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
213
  <main><header class="amp-wp-article-header ampforwp-title amp-wp-content">
214
  <h1 class="amp-wp-title"> <?php
 
 
 
 
 
 
 
215
  $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
 
216
  echo get_the_title( $ID ) ;?>
217
  </h1>
218
  </header></main><?php
26
  // Design #1
27
  function ampforwp_design_1_frontpage_content( $template, $post_id ){
28
  global $redux_builder_amp;
29
+ //WPML Static Front Page Support #1111
30
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
31
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
32
+ $post_id = get_option('page_on_front');
33
+
34
+ }
35
  $amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
36
 
37
  <article class="amp-wp-article">
98
  // Design #2
99
  function ampforwp_design_2_frontpage_content($template, $post_id){
100
  global $redux_builder_amp;
101
+ //WPML Static Front Page Support #1111
102
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
103
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
104
+ $post_id = get_option('page_on_front');
105
+
106
+ }
107
  $amp_custom_content_enable = get_post_meta($post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
108
 
109
  <main>
157
  // Design #3
158
  function ampforwp_design_3_frontpage_content($template, $post_id){
159
  global $redux_builder_amp;
160
+ //WPML Static Front Page Support #1111
161
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
162
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
163
+ $post_id = get_option('page_on_front');
164
+
165
+ }
166
  $amp_custom_content_enable = get_post_meta( $post_id, 'ampforwp_custom_content_editor_checkbox', true);?>
167
  <main>
168
  <div class="amp-wp-content the_content">
214
  // Frontpage Title for Design #2
215
  function ampforwp_design_2_frontpage_title() {
216
  global $redux_builder_amp;
217
+ //WPML Static Front Page Support #1111
218
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
219
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
220
+ $post_id = get_option('page_on_front');
221
+
222
+ }
223
  if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
224
  <header class="amp-wp-article-header ampforwp-title">
225
  <h1 class="amp-wp-title">
226
+ <?php if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
227
+ $ID = get_option('page_on_front');
228
+
229
+ }
230
+ else{
231
+ $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
232
+ }
233
  echo get_the_title( $ID ) ; ?>
234
  </h1>
235
  </header>
239
  // Frontpage Title for Design #3
240
  function ampforwp_design_3_frontpage_title() {
241
  global $redux_builder_amp;
242
+ //WPML Static Front Page Support #1111
243
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
244
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
245
+ $post_id = get_option('page_on_front');
246
+
247
+ }
248
  if( $redux_builder_amp['ampforwp-title-on-front-page'] ) { ?>
249
  <main><header class="amp-wp-article-header ampforwp-title amp-wp-content">
250
  <h1 class="amp-wp-title"> <?php
251
+ //WPML Static Front Page Support #1111
252
+ include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
253
+ if( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' )){
254
+ $ID = get_option('page_on_front');
255
+
256
+ }
257
+ else{
258
  $ID = $redux_builder_amp['amp-frontpage-select-option-pages'];
259
+ }
260
  echo get_the_title( $ID ) ;?>
261
  </h1>
262
  </header></main><?php
templates/report-bugs.php CHANGED
@@ -6,8 +6,8 @@ $sections[] = array(
6
  'title' => __( 'Send Feedback', 'accelerated-mobile-pages' ),
7
  // 'id' => 'opt-structured-data',
8
  // 'subsection' => true,
9
- 'icon' => 'el el-warning-sign ',
10
- 'desc' => "<p><br />".__("<h3>Tell Us What's Happening</h3><strong>We need your help in improving this plugin!</strong></p>
11
  <p>We take every issue and bug report very seriously. Me and my team personally goes through your feedback and works hard on solving them.</p>",'accelerated-mobile-pages')."
12
  <p>
13
  <a href='https://goo.gl/forms/zIks2sTbhBZK0A3L2' style='background: #E91E63;
6
  'title' => __( 'Send Feedback', 'accelerated-mobile-pages' ),
7
  // 'id' => 'opt-structured-data',
8
  // 'subsection' => true,
9
+ 'icon' => 'el el-group',
10
+ 'desc' => "<p>".__("<strong>We need your help in improving this plugin!</strong></p>
11
  <p>We take every issue and bug report very seriously. Me and my team personally goes through your feedback and works hard on solving them.</p>",'accelerated-mobile-pages')."
12
  <p>
13
  <a href='https://goo.gl/forms/zIks2sTbhBZK0A3L2' style='background: #E91E63;