@@ -11,221 +11,221 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | if ( interface_exists( 'WPSEO_Graph_Piece' ) ) { |
| 13 | 13 | |
| 14 | - class LSX_Schema_Graph_Piece implements WPSEO_Graph_Piece { |
|
| 15 | - /** |
|
| 16 | - * A value object with context variables. |
|
| 17 | - * |
|
| 18 | - * @var \WPSEO_Schema_Context |
|
| 19 | - */ |
|
| 20 | - public $context; |
|
| 21 | - /** |
|
| 22 | - * This is the post type that you want the piece to output for. |
|
| 23 | - * |
|
| 24 | - * @var string; |
|
| 25 | - */ |
|
| 26 | - public $post_type; |
|
| 27 | - /** |
|
| 28 | - * If this is a top level parent |
|
| 29 | - * |
|
| 30 | - * @var boolean |
|
| 31 | - */ |
|
| 32 | - public $is_top_level; |
|
| 33 | - /** |
|
| 34 | - * This holds the meta_key => scehma_type of the fields you want to add to your subtrip. |
|
| 35 | - * |
|
| 36 | - * @var array() |
|
| 37 | - */ |
|
| 38 | - public $place_ids; |
|
| 39 | - /** |
|
| 40 | - * This holds an object or the current trip post. |
|
| 41 | - * |
|
| 42 | - * @var WP_Post(); |
|
| 43 | - */ |
|
| 44 | - public $post; |
|
| 45 | - /** |
|
| 46 | - * This holds URL for the trip |
|
| 47 | - * |
|
| 48 | - * @var string |
|
| 49 | - */ |
|
| 50 | - public $post_url; |
|
| 51 | - /** |
|
| 52 | - * Constructor. |
|
| 53 | - * |
|
| 54 | - * @param \WPSEO_Schema_Context $context A value object with context variables. |
|
| 55 | - */ |
|
| 56 | - public function __construct( WPSEO_Schema_Context $context ) { |
|
| 57 | - $this->context = $context; |
|
| 58 | - $this->place_ids = array(); |
|
| 59 | - $this->post = get_post( $this->context->id ); |
|
| 60 | - $this->post_url = get_permalink( $this->context->id ); |
|
| 61 | - $this->is_top_level = false; |
|
| 62 | - if ( is_object( $this->post ) && isset( $this->post->post_parent ) && ( false === $this->post->post_parent || 0 === $this->post->post_parent || '' === $this->post->post_parent ) ) { |
|
| 63 | - $this->is_top_level = true; |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - /** |
|
| 67 | - * Determines whether or not a piece should be added to the graph. |
|
| 68 | - * |
|
| 69 | - * @return bool |
|
| 70 | - */ |
|
| 71 | - public function is_needed() { |
|
| 72 | - if ( ! is_singular() ) { |
|
| 73 | - return false; |
|
| 74 | - } |
|
| 75 | - if ( false === $this->context->site_represents ) { |
|
| 76 | - return false; |
|
| 77 | - } |
|
| 78 | - return LSX_Schema_Utils::is_type( get_post_type(), $this->post_type ); |
|
| 79 | - } |
|
| 80 | - /** |
|
| 81 | - * Returns Review data. |
|
| 82 | - * |
|
| 83 | - * @return array $data Review data. |
|
| 84 | - */ |
|
| 85 | - public function generate() { |
|
| 86 | - $data = array(); |
|
| 87 | - return $data; |
|
| 88 | - } |
|
| 89 | - /** |
|
| 90 | - * Gets the connected reviews post type and set it as the "Review" schema |
|
| 91 | - * |
|
| 92 | - * @param array $data An array of offers already added. |
|
| 93 | - * @param string $data_key |
|
| 94 | - * @param boolean $include_aggregate |
|
| 95 | - * @return array $data |
|
| 96 | - */ |
|
| 97 | - public function add_reviews( $data, $data_key = 'reviews', $include_aggregate = true ) { |
|
| 98 | - $reviews = get_post_meta( $this->context->id, 'review_to_' . $this->post_type, false ); |
|
| 99 | - $reviews_array = array(); |
|
| 100 | - if ( ! empty( $reviews ) ) { |
|
| 101 | - $aggregate_value = 1; |
|
| 102 | - $review_count = 0; |
|
| 103 | - foreach ( $reviews as $review_id ) { |
|
| 104 | - $rating = get_post_meta( $review_id, 'rating', true ); |
|
| 105 | - $author = get_post_meta( $review_id, 'reviewer_name', true ); |
|
| 106 | - $description = wp_strip_all_tags( get_the_excerpt( $review_id ) ); |
|
| 107 | - $review_args = array( |
|
| 108 | - 'author' => $author, |
|
| 109 | - 'reviewBody' => $description, |
|
| 110 | - ); |
|
| 111 | - // Add in the review rating. |
|
| 112 | - if ( false !== $rating && '' !== $rating && '0' !== $rating && 0 !== $rating ) { |
|
| 113 | - $review_args['reviewRating'] = array( |
|
| 114 | - '@type' => 'Rating', |
|
| 115 | - 'ratingValue' => $rating, |
|
| 116 | - ); |
|
| 117 | - } |
|
| 118 | - $reviews_array = LSX_Schema_Utils::add_review( $reviews_array, $review_id, $this->context, $review_args ); |
|
| 119 | - $review_count++; |
|
| 120 | - } |
|
| 121 | - if ( ! empty( $reviews_array ) ) { |
|
| 122 | - if ( true === $include_aggregate ) { |
|
| 123 | - $data['aggregateRating'] = array( |
|
| 124 | - '@type' => 'AggregateRating', |
|
| 125 | - 'ratingValue' => (string) $aggregate_value, |
|
| 126 | - 'reviewCount' => (string) $review_count, |
|
| 127 | - 'bestRating' => '5', |
|
| 128 | - 'worstRating' => '1', |
|
| 129 | - ); |
|
| 130 | - } |
|
| 131 | - $data[ $data_key ] = $reviews_array; |
|
| 132 | - } |
|
| 133 | - } |
|
| 134 | - return $data; |
|
| 135 | - } |
|
| 136 | - /** |
|
| 137 | - * Gets the connected posts and set it as the "Article" schema |
|
| 138 | - * |
|
| 139 | - * @param array $data An array of offers already added. |
|
| 140 | - * @param string $data_key |
|
| 141 | - * @return array $data |
|
| 142 | - */ |
|
| 143 | - public function add_articles( $data, $data_key = 'subjectOf' ) { |
|
| 144 | - $posts = get_post_meta( $this->context->id, 'post_to_' . $this->post_type, false ); |
|
| 145 | - $posts_array = array(); |
|
| 146 | - if ( ! empty( $posts ) ) { |
|
| 147 | - foreach ( $posts as $post_id ) { |
|
| 148 | - $post_args = array( |
|
| 149 | - 'articleBody' => wp_strip_all_tags( get_the_excerpt( $post_id ) ), |
|
| 150 | - 'headline' => get_the_title( $post_id ), |
|
| 151 | - ); |
|
| 152 | - $section = get_the_term_list( $post_id, 'category' ); |
|
| 153 | - if ( ! is_wp_error( $section ) && '' !== $section && false !== $section ) { |
|
| 154 | - $post_args['articleSection'] = wp_strip_all_tags( $section ); |
|
| 155 | - } |
|
| 156 | - if ( $this->context->site_represents_reference ) { |
|
| 157 | - $post_args['publisher'] = $this->context->site_represents_reference; |
|
| 158 | - } |
|
| 159 | - $image_url = get_the_post_thumbnail_url( $post_id, 'lsx-thumbnail-wide' ); |
|
| 160 | - if ( false !== $image_url ) { |
|
| 161 | - $post_args['image'] = $image_url; |
|
| 162 | - } |
|
| 163 | - $posts_array = LSX_Schema_Utils::add_article( $posts_array, $post_id, $this->context, $post_args ); |
|
| 164 | - } |
|
| 165 | - if ( ! empty( $posts_array ) ) { |
|
| 166 | - $data[ $data_key ] = $posts_array; |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - return $data; |
|
| 170 | - } |
|
| 171 | - /** |
|
| 172 | - * Adds the Project and Testimonials attached to the Team Member |
|
| 173 | - * |
|
| 174 | - * @param array $data |
|
| 175 | - * |
|
| 176 | - * @return array $data |
|
| 177 | - */ |
|
| 178 | - public function add_connections( $data ) { |
|
| 179 | - $connections_array = array(); |
|
| 180 | - if ( $this->is_top_level ) { |
|
| 181 | - $connections_array = $this->add_regions( $connections_array ); |
|
| 182 | - $connections_array = $this->add_accommodation( $connections_array ); |
|
| 183 | - if ( ! empty( $connections_array ) ) { |
|
| 184 | - $data['containsPlace'] = $connections_array; |
|
| 185 | - } |
|
| 186 | - } else { |
|
| 187 | - $connections_array = $this->add_countries( $connections_array ); |
|
| 188 | - $data['containedInPlace'] = $connections_array; |
|
| 189 | - $connections_array = array(); |
|
| 190 | - $connections_array = $this->add_accommodation( $connections_array ); |
|
| 191 | - $data['containsPlace'] = $connections_array; |
|
| 192 | - } |
|
| 193 | - return $data; |
|
| 194 | - } |
|
| 195 | - /** |
|
| 196 | - * Adds the terms for the taxonomy |
|
| 197 | - * |
|
| 198 | - * @param array $data Review data. |
|
| 199 | - * @param array $data_key the parameter name you wish to assign it to. |
|
| 200 | - * @param array $taxonomy the taxonomy to grab terms for. |
|
| 201 | - * |
|
| 202 | - * @return array $data Review data. |
|
| 203 | - */ |
|
| 204 | - public function add_taxonomy_terms( $data, $data_key, $taxonomy ) { |
|
| 205 | - /** |
|
| 206 | - * Filter: 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy' - Allow changing the taxonomy used to assign keywords to a post type Review data. |
|
| 207 | - * |
|
| 208 | - * @api string $taxonomy The chosen taxonomy. |
|
| 209 | - */ |
|
| 210 | - $taxonomy = apply_filters( 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy', $taxonomy ); |
|
| 211 | - return LSX_Schema_Utils::add_terms( $data, $this->context->id, $data_key, $taxonomy ); |
|
| 212 | - } |
|
| 213 | - /** |
|
| 214 | - * Adds the custom field value for the supplied key |
|
| 215 | - * |
|
| 216 | - * @param array $data Schema data. |
|
| 217 | - * @param string $data_key the parameter name you wish to assign it to. |
|
| 218 | - * @param string $meta_key the taxonomy to grab terms for. |
|
| 219 | - * @param boolean $single A single custom field or an array |
|
| 220 | - * |
|
| 221 | - * @return array $data Review data. |
|
| 222 | - */ |
|
| 223 | - public function add_custom_field( $data, $data_key, $meta_key, $single = true ) { |
|
| 224 | - $value = get_post_meta( $this->context->id, $meta_key, $single ); |
|
| 225 | - if ( '' !== $value && false !== $value ) { |
|
| 226 | - $data[ $data_key ] = $value; |
|
| 227 | - } |
|
| 228 | - return $data; |
|
| 229 | - } |
|
| 230 | - } |
|
| 14 | + class LSX_Schema_Graph_Piece implements WPSEO_Graph_Piece { |
|
| 15 | + /** |
|
| 16 | + * A value object with context variables. |
|
| 17 | + * |
|
| 18 | + * @var \WPSEO_Schema_Context |
|
| 19 | + */ |
|
| 20 | + public $context; |
|
| 21 | + /** |
|
| 22 | + * This is the post type that you want the piece to output for. |
|
| 23 | + * |
|
| 24 | + * @var string; |
|
| 25 | + */ |
|
| 26 | + public $post_type; |
|
| 27 | + /** |
|
| 28 | + * If this is a top level parent |
|
| 29 | + * |
|
| 30 | + * @var boolean |
|
| 31 | + */ |
|
| 32 | + public $is_top_level; |
|
| 33 | + /** |
|
| 34 | + * This holds the meta_key => scehma_type of the fields you want to add to your subtrip. |
|
| 35 | + * |
|
| 36 | + * @var array() |
|
| 37 | + */ |
|
| 38 | + public $place_ids; |
|
| 39 | + /** |
|
| 40 | + * This holds an object or the current trip post. |
|
| 41 | + * |
|
| 42 | + * @var WP_Post(); |
|
| 43 | + */ |
|
| 44 | + public $post; |
|
| 45 | + /** |
|
| 46 | + * This holds URL for the trip |
|
| 47 | + * |
|
| 48 | + * @var string |
|
| 49 | + */ |
|
| 50 | + public $post_url; |
|
| 51 | + /** |
|
| 52 | + * Constructor. |
|
| 53 | + * |
|
| 54 | + * @param \WPSEO_Schema_Context $context A value object with context variables. |
|
| 55 | + */ |
|
| 56 | + public function __construct( WPSEO_Schema_Context $context ) { |
|
| 57 | + $this->context = $context; |
|
| 58 | + $this->place_ids = array(); |
|
| 59 | + $this->post = get_post( $this->context->id ); |
|
| 60 | + $this->post_url = get_permalink( $this->context->id ); |
|
| 61 | + $this->is_top_level = false; |
|
| 62 | + if ( is_object( $this->post ) && isset( $this->post->post_parent ) && ( false === $this->post->post_parent || 0 === $this->post->post_parent || '' === $this->post->post_parent ) ) { |
|
| 63 | + $this->is_top_level = true; |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + /** |
|
| 67 | + * Determines whether or not a piece should be added to the graph. |
|
| 68 | + * |
|
| 69 | + * @return bool |
|
| 70 | + */ |
|
| 71 | + public function is_needed() { |
|
| 72 | + if ( ! is_singular() ) { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + if ( false === $this->context->site_represents ) { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 78 | + return LSX_Schema_Utils::is_type( get_post_type(), $this->post_type ); |
|
| 79 | + } |
|
| 80 | + /** |
|
| 81 | + * Returns Review data. |
|
| 82 | + * |
|
| 83 | + * @return array $data Review data. |
|
| 84 | + */ |
|
| 85 | + public function generate() { |
|
| 86 | + $data = array(); |
|
| 87 | + return $data; |
|
| 88 | + } |
|
| 89 | + /** |
|
| 90 | + * Gets the connected reviews post type and set it as the "Review" schema |
|
| 91 | + * |
|
| 92 | + * @param array $data An array of offers already added. |
|
| 93 | + * @param string $data_key |
|
| 94 | + * @param boolean $include_aggregate |
|
| 95 | + * @return array $data |
|
| 96 | + */ |
|
| 97 | + public function add_reviews( $data, $data_key = 'reviews', $include_aggregate = true ) { |
|
| 98 | + $reviews = get_post_meta( $this->context->id, 'review_to_' . $this->post_type, false ); |
|
| 99 | + $reviews_array = array(); |
|
| 100 | + if ( ! empty( $reviews ) ) { |
|
| 101 | + $aggregate_value = 1; |
|
| 102 | + $review_count = 0; |
|
| 103 | + foreach ( $reviews as $review_id ) { |
|
| 104 | + $rating = get_post_meta( $review_id, 'rating', true ); |
|
| 105 | + $author = get_post_meta( $review_id, 'reviewer_name', true ); |
|
| 106 | + $description = wp_strip_all_tags( get_the_excerpt( $review_id ) ); |
|
| 107 | + $review_args = array( |
|
| 108 | + 'author' => $author, |
|
| 109 | + 'reviewBody' => $description, |
|
| 110 | + ); |
|
| 111 | + // Add in the review rating. |
|
| 112 | + if ( false !== $rating && '' !== $rating && '0' !== $rating && 0 !== $rating ) { |
|
| 113 | + $review_args['reviewRating'] = array( |
|
| 114 | + '@type' => 'Rating', |
|
| 115 | + 'ratingValue' => $rating, |
|
| 116 | + ); |
|
| 117 | + } |
|
| 118 | + $reviews_array = LSX_Schema_Utils::add_review( $reviews_array, $review_id, $this->context, $review_args ); |
|
| 119 | + $review_count++; |
|
| 120 | + } |
|
| 121 | + if ( ! empty( $reviews_array ) ) { |
|
| 122 | + if ( true === $include_aggregate ) { |
|
| 123 | + $data['aggregateRating'] = array( |
|
| 124 | + '@type' => 'AggregateRating', |
|
| 125 | + 'ratingValue' => (string) $aggregate_value, |
|
| 126 | + 'reviewCount' => (string) $review_count, |
|
| 127 | + 'bestRating' => '5', |
|
| 128 | + 'worstRating' => '1', |
|
| 129 | + ); |
|
| 130 | + } |
|
| 131 | + $data[ $data_key ] = $reviews_array; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | + return $data; |
|
| 135 | + } |
|
| 136 | + /** |
|
| 137 | + * Gets the connected posts and set it as the "Article" schema |
|
| 138 | + * |
|
| 139 | + * @param array $data An array of offers already added. |
|
| 140 | + * @param string $data_key |
|
| 141 | + * @return array $data |
|
| 142 | + */ |
|
| 143 | + public function add_articles( $data, $data_key = 'subjectOf' ) { |
|
| 144 | + $posts = get_post_meta( $this->context->id, 'post_to_' . $this->post_type, false ); |
|
| 145 | + $posts_array = array(); |
|
| 146 | + if ( ! empty( $posts ) ) { |
|
| 147 | + foreach ( $posts as $post_id ) { |
|
| 148 | + $post_args = array( |
|
| 149 | + 'articleBody' => wp_strip_all_tags( get_the_excerpt( $post_id ) ), |
|
| 150 | + 'headline' => get_the_title( $post_id ), |
|
| 151 | + ); |
|
| 152 | + $section = get_the_term_list( $post_id, 'category' ); |
|
| 153 | + if ( ! is_wp_error( $section ) && '' !== $section && false !== $section ) { |
|
| 154 | + $post_args['articleSection'] = wp_strip_all_tags( $section ); |
|
| 155 | + } |
|
| 156 | + if ( $this->context->site_represents_reference ) { |
|
| 157 | + $post_args['publisher'] = $this->context->site_represents_reference; |
|
| 158 | + } |
|
| 159 | + $image_url = get_the_post_thumbnail_url( $post_id, 'lsx-thumbnail-wide' ); |
|
| 160 | + if ( false !== $image_url ) { |
|
| 161 | + $post_args['image'] = $image_url; |
|
| 162 | + } |
|
| 163 | + $posts_array = LSX_Schema_Utils::add_article( $posts_array, $post_id, $this->context, $post_args ); |
|
| 164 | + } |
|
| 165 | + if ( ! empty( $posts_array ) ) { |
|
| 166 | + $data[ $data_key ] = $posts_array; |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + return $data; |
|
| 170 | + } |
|
| 171 | + /** |
|
| 172 | + * Adds the Project and Testimonials attached to the Team Member |
|
| 173 | + * |
|
| 174 | + * @param array $data |
|
| 175 | + * |
|
| 176 | + * @return array $data |
|
| 177 | + */ |
|
| 178 | + public function add_connections( $data ) { |
|
| 179 | + $connections_array = array(); |
|
| 180 | + if ( $this->is_top_level ) { |
|
| 181 | + $connections_array = $this->add_regions( $connections_array ); |
|
| 182 | + $connections_array = $this->add_accommodation( $connections_array ); |
|
| 183 | + if ( ! empty( $connections_array ) ) { |
|
| 184 | + $data['containsPlace'] = $connections_array; |
|
| 185 | + } |
|
| 186 | + } else { |
|
| 187 | + $connections_array = $this->add_countries( $connections_array ); |
|
| 188 | + $data['containedInPlace'] = $connections_array; |
|
| 189 | + $connections_array = array(); |
|
| 190 | + $connections_array = $this->add_accommodation( $connections_array ); |
|
| 191 | + $data['containsPlace'] = $connections_array; |
|
| 192 | + } |
|
| 193 | + return $data; |
|
| 194 | + } |
|
| 195 | + /** |
|
| 196 | + * Adds the terms for the taxonomy |
|
| 197 | + * |
|
| 198 | + * @param array $data Review data. |
|
| 199 | + * @param array $data_key the parameter name you wish to assign it to. |
|
| 200 | + * @param array $taxonomy the taxonomy to grab terms for. |
|
| 201 | + * |
|
| 202 | + * @return array $data Review data. |
|
| 203 | + */ |
|
| 204 | + public function add_taxonomy_terms( $data, $data_key, $taxonomy ) { |
|
| 205 | + /** |
|
| 206 | + * Filter: 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy' - Allow changing the taxonomy used to assign keywords to a post type Review data. |
|
| 207 | + * |
|
| 208 | + * @api string $taxonomy The chosen taxonomy. |
|
| 209 | + */ |
|
| 210 | + $taxonomy = apply_filters( 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy', $taxonomy ); |
|
| 211 | + return LSX_Schema_Utils::add_terms( $data, $this->context->id, $data_key, $taxonomy ); |
|
| 212 | + } |
|
| 213 | + /** |
|
| 214 | + * Adds the custom field value for the supplied key |
|
| 215 | + * |
|
| 216 | + * @param array $data Schema data. |
|
| 217 | + * @param string $data_key the parameter name you wish to assign it to. |
|
| 218 | + * @param string $meta_key the taxonomy to grab terms for. |
|
| 219 | + * @param boolean $single A single custom field or an array |
|
| 220 | + * |
|
| 221 | + * @return array $data Review data. |
|
| 222 | + */ |
|
| 223 | + public function add_custom_field( $data, $data_key, $meta_key, $single = true ) { |
|
| 224 | + $value = get_post_meta( $this->context->id, $meta_key, $single ); |
|
| 225 | + if ( '' !== $value && false !== $value ) { |
|
| 226 | + $data[ $data_key ] = $value; |
|
| 227 | + } |
|
| 228 | + return $data; |
|
| 229 | + } |
|
| 230 | + } |
|
| 231 | 231 | } |
@@ -8,77 +8,77 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( ! class_exists( 'WP_Customize_Control' ) ) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if ( ! class_exists( 'LSX_Customize_Layout_Control' ) ) : |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * LSX_Customize_Layout_Control Class. |
|
| 22 | - * |
|
| 23 | - * @package lsx |
|
| 24 | - * @subpackage customizer |
|
| 25 | - * @category layout |
|
| 26 | - */ |
|
| 27 | - class LSX_Customize_Layout_Control extends WP_Customize_Control { |
|
| 20 | + /** |
|
| 21 | + * LSX_Customize_Layout_Control Class. |
|
| 22 | + * |
|
| 23 | + * @package lsx |
|
| 24 | + * @subpackage customizer |
|
| 25 | + * @category layout |
|
| 26 | + */ |
|
| 27 | + class LSX_Customize_Layout_Control extends WP_Customize_Control { |
|
| 28 | 28 | |
| 29 | - public $type = 'layout'; |
|
| 30 | - public $statuses; |
|
| 31 | - public $layouts = array(); |
|
| 29 | + public $type = 'layout'; |
|
| 30 | + public $statuses; |
|
| 31 | + public $layouts = array(); |
|
| 32 | 32 | |
| 33 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | - parent::__construct( $manager, $id, $args ); |
|
| 35 | - if ( ! empty( $args['choices'] ) ) { |
|
| 36 | - $this->layouts = $args['choices']; |
|
| 37 | - } |
|
| 38 | - } |
|
| 33 | + public function __construct( $manager, $id, $args = array() ) { |
|
| 34 | + parent::__construct( $manager, $id, $args ); |
|
| 35 | + if ( ! empty( $args['choices'] ) ) { |
|
| 36 | + $this->layouts = $args['choices']; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * Enqueue scripts/styles for the color picker. |
|
| 42 | - */ |
|
| 43 | - public function enqueue() { |
|
| 44 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 45 | - } |
|
| 40 | + /** |
|
| 41 | + * Enqueue scripts/styles for the color picker. |
|
| 42 | + */ |
|
| 43 | + public function enqueue() { |
|
| 44 | + wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() . '/assets/js/admin/customizer-layout.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Render output. |
|
| 49 | - */ |
|
| 50 | - public function render_content() { |
|
| 51 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 52 | - $class = 'customize-control customize-control-' . $this->type; |
|
| 53 | - $value = $this->value(); |
|
| 54 | - ?> |
|
| 47 | + /** |
|
| 48 | + * Render output. |
|
| 49 | + */ |
|
| 50 | + public function render_content() { |
|
| 51 | + $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 52 | + $class = 'customize-control customize-control-' . $this->type; |
|
| 53 | + $value = $this->value(); |
|
| 54 | + ?> |
|
| 55 | 55 | <label> |
| 56 | 56 | <?php |
| 57 | - if ( ! empty( $this->label ) ) { |
|
| 58 | - ?> |
|
| 57 | + if ( ! empty( $this->label ) ) { |
|
| 58 | + ?> |
|
| 59 | 59 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
| 60 | 60 | <?php |
| 61 | - } |
|
| 62 | - if ( ! empty( $this->description ) ) { |
|
| 63 | - ?> |
|
| 61 | + } |
|
| 62 | + if ( ! empty( $this->description ) ) { |
|
| 63 | + ?> |
|
| 64 | 64 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
| 65 | 65 | <?php } ?> |
| 66 | 66 | <div class="layouts-selector"> |
| 67 | 67 | <?php |
| 68 | - foreach ( $this->layouts as $layout ) { |
|
| 69 | - $sel = 'border: 1px solid transparent;'; |
|
| 70 | - if ( $value === $layout ) { |
|
| 71 | - $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 72 | - } |
|
| 73 | - echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 74 | - } |
|
| 75 | - ?> |
|
| 68 | + foreach ( $this->layouts as $layout ) { |
|
| 69 | + $sel = 'border: 1px solid transparent;'; |
|
| 70 | + if ( $value === $layout ) { |
|
| 71 | + $sel = 'border: 1px solid rgb(43, 166, 203);'; |
|
| 72 | + } |
|
| 73 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr( $sel ) . '" src="' . esc_attr( get_template_directory_uri() ) . '/assets/images/admin/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 74 | + } |
|
| 75 | + ?> |
|
| 76 | 76 | <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
| 77 | 77 | </div> |
| 78 | 78 | </label> |
| 79 | 79 | <?php |
| 80 | - } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - } |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | 84 | endif; |
@@ -8,232 +8,232 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | - exit; |
|
| 11 | + exit; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | if ( ! class_exists( 'Walker_Nav_Menu' ) ) { |
| 15 | - return; |
|
| 15 | + return; |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if ( ! class_exists( 'LSX_Bootstrap_Navwalker' ) ) : |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * Cleaner Bootstrap walker |
|
| 22 | - * |
|
| 23 | - * @package lsx |
|
| 24 | - * @subpackage navigation |
|
| 25 | - * @category bootstrap-navigation-walker |
|
| 26 | - */ |
|
| 27 | - class LSX_Bootstrap_Navwalker extends Walker_Nav_Menu { |
|
| 28 | - |
|
| 29 | - /** |
|
| 30 | - * Used to append additional content. |
|
| 31 | - * |
|
| 32 | - * @see Walker::start_lvl() |
|
| 33 | - * @since 3.0.0 |
|
| 34 | - * |
|
| 35 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 36 | - * @param int $depth Depth of page. Used for padding. |
|
| 37 | - */ |
|
| 38 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 39 | - $indent = str_repeat( "\t", $depth ); |
|
| 40 | - $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - /** |
|
| 44 | - * Used to append additional content. |
|
| 45 | - * @param string $item Passed by reference. |
|
| 46 | - */ |
|
| 47 | - public function filter_default_pages( &$item ) { |
|
| 48 | - return $item; |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * @see Walker::start_el() |
|
| 53 | - * @since 3.0.0 |
|
| 54 | - * |
|
| 55 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 56 | - * @param object $item Menu item data object. |
|
| 57 | - * @param int $depth Depth of menu item. Used for padding. |
|
| 58 | - * @param int $current_page Menu item ID. |
|
| 59 | - * @param object $args |
|
| 60 | - */ |
|
| 61 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 62 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 63 | - |
|
| 64 | - /** |
|
| 65 | - * If this is a default menu being called we need to fix |
|
| 66 | - * the item object thats coming through. |
|
| 67 | - */ |
|
| 68 | - if ( ! isset( $item->title ) ) { |
|
| 69 | - return; |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - /** |
|
| 73 | - * Dividers, Headers or Disabled |
|
| 74 | - * ============================= |
|
| 75 | - * Determine whether the item is a Divider, Header, Disabled or regular |
|
| 76 | - * menu item. To prevent errors we use the strcasecmp() function to so a |
|
| 77 | - * comparison that is not case sensitive. The strcasecmp() function returns |
|
| 78 | - * a 0 if the strings are equal. |
|
| 79 | - */ |
|
| 80 | - if ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { |
|
| 81 | - $output .= $indent . '<li role="presentation" class="divider">'; |
|
| 82 | - } elseif ( 0 == strcasecmp( $item->title, 'divider' ) && 1 === $depth ) { |
|
| 83 | - $output .= $indent . '<li role="presentation" class="divider">'; |
|
| 84 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'dropdown-header' ) && 1 === $depth ) { |
|
| 85 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 86 | - } elseif ( 0 == strcasecmp( $item->attr_title, 'disabled' ) ) { |
|
| 87 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 88 | - } else { |
|
| 89 | - $class_names = ''; |
|
| 90 | - $value = ''; |
|
| 91 | - |
|
| 92 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 93 | - $classes[] = 'menu-item-' . $item->ID; |
|
| 94 | - |
|
| 95 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ); |
|
| 96 | - |
|
| 97 | - $class_names = join( ' ', $classes ); |
|
| 98 | - |
|
| 99 | - if ( $args->has_children ) |
|
| 100 | - $class_names .= ' dropdown'; |
|
| 101 | - |
|
| 102 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 103 | - $class_names .= ' active'; |
|
| 104 | - |
|
| 105 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 106 | - $class_names .= ' active'; |
|
| 107 | - |
|
| 108 | - //Check if this is ment to be a "social" type menu |
|
| 109 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 110 | - |
|
| 111 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args ); |
|
| 112 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 113 | - |
|
| 114 | - $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
| 115 | - |
|
| 116 | - $atts = array(); |
|
| 117 | - $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : $item->title; |
|
| 118 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 119 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 120 | - |
|
| 121 | - // If item has_children add atts to a. |
|
| 122 | - if ( $args->has_children ) { |
|
| 123 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 124 | - $atts['data-toggle'] = 'dropdown'; |
|
| 125 | - $atts['class'] = 'dropdown-toggle'; |
|
| 126 | - $atts['aria-haspopup'] = 'true'; |
|
| 127 | - } else { |
|
| 128 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 132 | - |
|
| 133 | - $attributes = ''; |
|
| 134 | - foreach ( $atts as $attr => $value ) { |
|
| 135 | - if ( ! empty( $value ) ) { |
|
| 136 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 137 | - $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
| 138 | - } |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - $item_output = $args->before; |
|
| 142 | - |
|
| 143 | - $item_output .= '<a' . $attributes . '>'; |
|
| 144 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 145 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 146 | - $item_output .= $args->after; |
|
| 147 | - |
|
| 148 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - /** |
|
| 153 | - * Traverse elements to create list from elements. |
|
| 154 | - * |
|
| 155 | - * Display one element if the element doesn't have any children otherwise, |
|
| 156 | - * display the element and its children. Will only traverse up to the max |
|
| 157 | - * depth and no ignore elements under that depth. |
|
| 158 | - * |
|
| 159 | - * This method shouldn't be called directly, use the walk() method instead. |
|
| 160 | - * |
|
| 161 | - * @see Walker::start_el() |
|
| 162 | - * @since 2.5.0 |
|
| 163 | - * |
|
| 164 | - * @param object $element Data object |
|
| 165 | - * @param array $children_elements List of elements to continue traversing. |
|
| 166 | - * @param int $max_depth Max depth to traverse. |
|
| 167 | - * @param int $depth Depth of current element. |
|
| 168 | - * @param array $args |
|
| 169 | - * @param string $output Passed by reference. Used to append additional content. |
|
| 170 | - * @return null Null on failure with no changes to parameters. |
|
| 171 | - */ |
|
| 172 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 173 | - if ( ! $element ) { |
|
| 174 | - return; |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - $id_field = $this->db_fields['id']; |
|
| 178 | - |
|
| 179 | - if ( is_object( $args[0] ) ) { |
|
| 180 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Menu Fallback |
|
| 188 | - * ============= |
|
| 189 | - * If this function is assigned to the wp_nav_menu's fallback_cb variable |
|
| 190 | - * and a manu has not been assigned to the theme location in the WordPress |
|
| 191 | - * menu manager the function with display nothing to a non-logged in user, |
|
| 192 | - * and will add a link to the WordPress menu manager if logged in as an admin. |
|
| 193 | - * |
|
| 194 | - * @param array $args passed from the wp_nav_menu function. |
|
| 195 | - * |
|
| 196 | - */ |
|
| 197 | - public static function fallback( $args ) { |
|
| 198 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 199 | - $fb_output = null; |
|
| 200 | - |
|
| 201 | - if ( $args['container'] ) { |
|
| 202 | - $fb_output = '<' . $args['container']; |
|
| 203 | - |
|
| 204 | - if ( $args['container_id'] ) { |
|
| 205 | - $fb_output .= ' id="' . $args['container_id'] . '"'; |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - if ( $args['container_class'] ) { |
|
| 209 | - $fb_output .= ' class="' . $args['container_class'] . '"'; |
|
| 210 | - } |
|
| 211 | - |
|
| 212 | - $fb_output .= '>'; |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - $fb_output .= '<ul'; |
|
| 216 | - |
|
| 217 | - if ( $args['menu_id'] ) { |
|
| 218 | - $fb_output .= ' id="' . $args['menu_id'] . '"'; |
|
| 219 | - } |
|
| 220 | - |
|
| 221 | - if ( $args['menu_class'] ) { |
|
| 222 | - $fb_output .= ' class="' . $args['menu_class'] . '"'; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - $fb_output .= '>'; |
|
| 226 | - $fb_output .= '<li><a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
|
| 227 | - $fb_output .= '</ul>'; |
|
| 228 | - |
|
| 229 | - if ( $args['container'] ) { |
|
| 230 | - $fb_output .= '</' . $args['container'] . '>'; |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - echo wp_kses_post( $fb_output ); |
|
| 234 | - } |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - } |
|
| 20 | + /** |
|
| 21 | + * Cleaner Bootstrap walker |
|
| 22 | + * |
|
| 23 | + * @package lsx |
|
| 24 | + * @subpackage navigation |
|
| 25 | + * @category bootstrap-navigation-walker |
|
| 26 | + */ |
|
| 27 | + class LSX_Bootstrap_Navwalker extends Walker_Nav_Menu { |
|
| 28 | + |
|
| 29 | + /** |
|
| 30 | + * Used to append additional content. |
|
| 31 | + * |
|
| 32 | + * @see Walker::start_lvl() |
|
| 33 | + * @since 3.0.0 |
|
| 34 | + * |
|
| 35 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 36 | + * @param int $depth Depth of page. Used for padding. |
|
| 37 | + */ |
|
| 38 | + public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 39 | + $indent = str_repeat( "\t", $depth ); |
|
| 40 | + $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * Used to append additional content. |
|
| 45 | + * @param string $item Passed by reference. |
|
| 46 | + */ |
|
| 47 | + public function filter_default_pages( &$item ) { |
|
| 48 | + return $item; |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * @see Walker::start_el() |
|
| 53 | + * @since 3.0.0 |
|
| 54 | + * |
|
| 55 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 56 | + * @param object $item Menu item data object. |
|
| 57 | + * @param int $depth Depth of menu item. Used for padding. |
|
| 58 | + * @param int $current_page Menu item ID. |
|
| 59 | + * @param object $args |
|
| 60 | + */ |
|
| 61 | + public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 62 | + $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 63 | + |
|
| 64 | + /** |
|
| 65 | + * If this is a default menu being called we need to fix |
|
| 66 | + * the item object thats coming through. |
|
| 67 | + */ |
|
| 68 | + if ( ! isset( $item->title ) ) { |
|
| 69 | + return; |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * Dividers, Headers or Disabled |
|
| 74 | + * ============================= |
|
| 75 | + * Determine whether the item is a Divider, Header, Disabled or regular |
|
| 76 | + * menu item. To prevent errors we use the strcasecmp() function to so a |
|
| 77 | + * comparison that is not case sensitive. The strcasecmp() function returns |
|
| 78 | + * a 0 if the strings are equal. |
|
| 79 | + */ |
|
| 80 | + if ( 0 == strcasecmp( $item->attr_title, 'divider' ) && 1 === $depth ) { |
|
| 81 | + $output .= $indent . '<li role="presentation" class="divider">'; |
|
| 82 | + } elseif ( 0 == strcasecmp( $item->title, 'divider' ) && 1 === $depth ) { |
|
| 83 | + $output .= $indent . '<li role="presentation" class="divider">'; |
|
| 84 | + } elseif ( 0 == strcasecmp( $item->attr_title, 'dropdown-header' ) && 1 === $depth ) { |
|
| 85 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 86 | + } elseif ( 0 == strcasecmp( $item->attr_title, 'disabled' ) ) { |
|
| 87 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 88 | + } else { |
|
| 89 | + $class_names = ''; |
|
| 90 | + $value = ''; |
|
| 91 | + |
|
| 92 | + $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 93 | + $classes[] = 'menu-item-' . $item->ID; |
|
| 94 | + |
|
| 95 | + $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args, $depth ); |
|
| 96 | + |
|
| 97 | + $class_names = join( ' ', $classes ); |
|
| 98 | + |
|
| 99 | + if ( $args->has_children ) |
|
| 100 | + $class_names .= ' dropdown'; |
|
| 101 | + |
|
| 102 | + if ( in_array( 'current-menu-item', $classes ) ) |
|
| 103 | + $class_names .= ' active'; |
|
| 104 | + |
|
| 105 | + if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 106 | + $class_names .= ' active'; |
|
| 107 | + |
|
| 108 | + //Check if this is ment to be a "social" type menu |
|
| 109 | + $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 110 | + |
|
| 111 | + $id = apply_filters( 'nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args ); |
|
| 112 | + $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 113 | + |
|
| 114 | + $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
| 115 | + |
|
| 116 | + $atts = array(); |
|
| 117 | + $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : $item->title; |
|
| 118 | + $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 119 | + $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 120 | + |
|
| 121 | + // If item has_children add atts to a. |
|
| 122 | + if ( $args->has_children ) { |
|
| 123 | + $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 124 | + $atts['data-toggle'] = 'dropdown'; |
|
| 125 | + $atts['class'] = 'dropdown-toggle'; |
|
| 126 | + $atts['aria-haspopup'] = 'true'; |
|
| 127 | + } else { |
|
| 128 | + $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 132 | + |
|
| 133 | + $attributes = ''; |
|
| 134 | + foreach ( $atts as $attr => $value ) { |
|
| 135 | + if ( ! empty( $value ) ) { |
|
| 136 | + $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 137 | + $attributes .= ' ' . $attr . '="' . $value . '"'; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + $item_output = $args->before; |
|
| 142 | + |
|
| 143 | + $item_output .= '<a' . $attributes . '>'; |
|
| 144 | + $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 145 | + $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 146 | + $item_output .= $args->after; |
|
| 147 | + |
|
| 148 | + $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + /** |
|
| 153 | + * Traverse elements to create list from elements. |
|
| 154 | + * |
|
| 155 | + * Display one element if the element doesn't have any children otherwise, |
|
| 156 | + * display the element and its children. Will only traverse up to the max |
|
| 157 | + * depth and no ignore elements under that depth. |
|
| 158 | + * |
|
| 159 | + * This method shouldn't be called directly, use the walk() method instead. |
|
| 160 | + * |
|
| 161 | + * @see Walker::start_el() |
|
| 162 | + * @since 2.5.0 |
|
| 163 | + * |
|
| 164 | + * @param object $element Data object |
|
| 165 | + * @param array $children_elements List of elements to continue traversing. |
|
| 166 | + * @param int $max_depth Max depth to traverse. |
|
| 167 | + * @param int $depth Depth of current element. |
|
| 168 | + * @param array $args |
|
| 169 | + * @param string $output Passed by reference. Used to append additional content. |
|
| 170 | + * @return null Null on failure with no changes to parameters. |
|
| 171 | + */ |
|
| 172 | + public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 173 | + if ( ! $element ) { |
|
| 174 | + return; |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + $id_field = $this->db_fields['id']; |
|
| 178 | + |
|
| 179 | + if ( is_object( $args[0] ) ) { |
|
| 180 | + $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Menu Fallback |
|
| 188 | + * ============= |
|
| 189 | + * If this function is assigned to the wp_nav_menu's fallback_cb variable |
|
| 190 | + * and a manu has not been assigned to the theme location in the WordPress |
|
| 191 | + * menu manager the function with display nothing to a non-logged in user, |
|
| 192 | + * and will add a link to the WordPress menu manager if logged in as an admin. |
|
| 193 | + * |
|
| 194 | + * @param array $args passed from the wp_nav_menu function. |
|
| 195 | + * |
|
| 196 | + */ |
|
| 197 | + public static function fallback( $args ) { |
|
| 198 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 199 | + $fb_output = null; |
|
| 200 | + |
|
| 201 | + if ( $args['container'] ) { |
|
| 202 | + $fb_output = '<' . $args['container']; |
|
| 203 | + |
|
| 204 | + if ( $args['container_id'] ) { |
|
| 205 | + $fb_output .= ' id="' . $args['container_id'] . '"'; |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + if ( $args['container_class'] ) { |
|
| 209 | + $fb_output .= ' class="' . $args['container_class'] . '"'; |
|
| 210 | + } |
|
| 211 | + |
|
| 212 | + $fb_output .= '>'; |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + $fb_output .= '<ul'; |
|
| 216 | + |
|
| 217 | + if ( $args['menu_id'] ) { |
|
| 218 | + $fb_output .= ' id="' . $args['menu_id'] . '"'; |
|
| 219 | + } |
|
| 220 | + |
|
| 221 | + if ( $args['menu_class'] ) { |
|
| 222 | + $fb_output .= ' class="' . $args['menu_class'] . '"'; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + $fb_output .= '>'; |
|
| 226 | + $fb_output .= '<li><a href="' . esc_url( admin_url( 'nav-menus.php' ) ) . '">' . esc_html__( 'Add a menu', 'lsx' ) . '</a></li>'; |
|
| 227 | + $fb_output .= '</ul>'; |
|
| 228 | + |
|
| 229 | + if ( $args['container'] ) { |
|
| 230 | + $fb_output .= '</' . $args['container'] . '>'; |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + echo wp_kses_post( $fb_output ); |
|
| 234 | + } |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | 239 | endif; |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | <?php if ( have_posts() ) : ?> |
| 21 | 21 | |
| 22 | 22 | <?php |
| 23 | - while ( have_posts() ) : |
|
| 24 | - the_post(); |
|
| 25 | - ?> |
|
| 23 | + while ( have_posts() ) : |
|
| 24 | + the_post(); |
|
| 25 | + ?> |
|
| 26 | 26 | |
| 27 | 27 | <?php |
| 28 | - if ( is_singular( 'post' ) ) { |
|
| 29 | - get_template_part( 'partials/content', 'post' ); |
|
| 30 | - } else { |
|
| 31 | - get_template_part( 'partials/content', 'custom' ); |
|
| 32 | - } |
|
| 33 | - ?> |
|
| 28 | + if ( is_singular( 'post' ) ) { |
|
| 29 | + get_template_part( 'partials/content', 'post' ); |
|
| 30 | + } else { |
|
| 31 | + get_template_part( 'partials/content', 'custom' ); |
|
| 32 | + } |
|
| 33 | + ?> |
|
| 34 | 34 | |
| 35 | 35 | <?php endwhile; ?> |
| 36 | 36 | |
@@ -43,16 +43,16 @@ discard block |
||
| 43 | 43 | <?php lsx_content_after(); ?> |
| 44 | 44 | |
| 45 | 45 | <?php |
| 46 | - if ( is_singular( 'post' ) ) { |
|
| 47 | - lsx_post_nav(); |
|
| 48 | - } |
|
| 49 | - ?> |
|
| 46 | + if ( is_singular( 'post' ) ) { |
|
| 47 | + lsx_post_nav(); |
|
| 48 | + } |
|
| 49 | + ?> |
|
| 50 | 50 | |
| 51 | 51 | <?php |
| 52 | - if ( comments_open() ) { |
|
| 53 | - comments_template(); |
|
| 54 | - } |
|
| 55 | - ?> |
|
| 52 | + if ( comments_open() ) { |
|
| 53 | + comments_template(); |
|
| 54 | + } |
|
| 55 | + ?> |
|
| 56 | 56 | |
| 57 | 57 | </div><!-- #primary --> |
| 58 | 58 | |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | */ |
| 8 | 8 | function editor_styles() { |
| 9 | 9 | |
| 10 | - // Enqueue shared editor styles. |
|
| 11 | - add_editor_style( |
|
| 12 | - '/assets/css/admin/gutenberg-admin.css' |
|
| 13 | - ); |
|
| 14 | - add_editor_style( |
|
| 15 | - '/assets/css/yoast/yoast.css' |
|
| 16 | - ); |
|
| 10 | + // Enqueue shared editor styles. |
|
| 11 | + add_editor_style( |
|
| 12 | + '/assets/css/admin/gutenberg-admin.css' |
|
| 13 | + ); |
|
| 14 | + add_editor_style( |
|
| 15 | + '/assets/css/yoast/yoast.css' |
|
| 16 | + ); |
|
| 17 | 17 | |
| 18 | 18 | } |
| 19 | 19 | add_action( 'admin_init', 'editor_styles' ); |
@@ -25,136 +25,136 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | 27 | if ( ! function_exists( 'theme_support' ) ) : |
| 28 | - /** |
|
| 29 | - * Add theme support functions. |
|
| 30 | - * |
|
| 31 | - * @return void |
|
| 32 | - */ |
|
| 33 | - function theme_support() { |
|
| 34 | - // Add support for editor styles. |
|
| 35 | - add_theme_support( 'editor-styles' ); |
|
| 36 | - // Add support for full and wide align images. |
|
| 37 | - add_theme_support( 'align-wide' ); |
|
| 38 | - // Add support for styling blocks. |
|
| 39 | - add_theme_support( 'wp-block-styles' ); |
|
| 40 | - // Add support for responsive embedded content. |
|
| 41 | - add_theme_support( 'responsive-embeds' ); |
|
| 42 | - // Add support for Custom Line Heights. |
|
| 43 | - add_theme_support( 'custom-line-height' ); |
|
| 44 | - // Add support for Custom Units. |
|
| 45 | - add_theme_support( 'custom-units' ); |
|
| 46 | - // Add custom editor font sizes. |
|
| 47 | - add_theme_support( |
|
| 48 | - 'editor-font-sizes', |
|
| 49 | - array( |
|
| 50 | - array( |
|
| 51 | - 'name' => esc_html_x( 'Small', 'font size option label', 'lsx' ), |
|
| 52 | - 'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ), |
|
| 53 | - 'size' => 13, |
|
| 54 | - 'slug' => 'small', |
|
| 55 | - ), |
|
| 56 | - array( |
|
| 57 | - 'name' => esc_html_x( 'Normal', 'font size option label', 'lsx' ), |
|
| 58 | - 'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ), |
|
| 59 | - 'size' => 15, |
|
| 60 | - 'slug' => 'normal', |
|
| 61 | - ), |
|
| 62 | - array( |
|
| 63 | - 'name' => esc_html_x( 'Medium', 'font size option label', 'lsx' ), |
|
| 64 | - 'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ), |
|
| 65 | - 'size' => 22, |
|
| 66 | - 'slug' => 'medium', |
|
| 67 | - ), |
|
| 68 | - array( |
|
| 69 | - 'name' => esc_html_x( 'Large', 'font size option label', 'lsx' ), |
|
| 70 | - 'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ), |
|
| 71 | - 'size' => 30, |
|
| 72 | - 'slug' => 'large', |
|
| 73 | - ), |
|
| 74 | - array( |
|
| 75 | - 'name' => esc_html_x( 'Huge', 'font size option label', 'lsx' ), |
|
| 76 | - 'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ), |
|
| 77 | - 'size' => 40, |
|
| 78 | - 'slug' => 'huge', |
|
| 79 | - ), |
|
| 80 | - ) |
|
| 81 | - ); |
|
| 28 | + /** |
|
| 29 | + * Add theme support functions. |
|
| 30 | + * |
|
| 31 | + * @return void |
|
| 32 | + */ |
|
| 33 | + function theme_support() { |
|
| 34 | + // Add support for editor styles. |
|
| 35 | + add_theme_support( 'editor-styles' ); |
|
| 36 | + // Add support for full and wide align images. |
|
| 37 | + add_theme_support( 'align-wide' ); |
|
| 38 | + // Add support for styling blocks. |
|
| 39 | + add_theme_support( 'wp-block-styles' ); |
|
| 40 | + // Add support for responsive embedded content. |
|
| 41 | + add_theme_support( 'responsive-embeds' ); |
|
| 42 | + // Add support for Custom Line Heights. |
|
| 43 | + add_theme_support( 'custom-line-height' ); |
|
| 44 | + // Add support for Custom Units. |
|
| 45 | + add_theme_support( 'custom-units' ); |
|
| 46 | + // Add custom editor font sizes. |
|
| 47 | + add_theme_support( |
|
| 48 | + 'editor-font-sizes', |
|
| 49 | + array( |
|
| 50 | + array( |
|
| 51 | + 'name' => esc_html_x( 'Small', 'font size option label', 'lsx' ), |
|
| 52 | + 'shortName' => esc_html_x( 'S', 'abbreviation of the font size option label', 'lsx' ), |
|
| 53 | + 'size' => 13, |
|
| 54 | + 'slug' => 'small', |
|
| 55 | + ), |
|
| 56 | + array( |
|
| 57 | + 'name' => esc_html_x( 'Normal', 'font size option label', 'lsx' ), |
|
| 58 | + 'shortName' => esc_html_x( 'N', 'abbreviation of the font size option label', 'lsx' ), |
|
| 59 | + 'size' => 15, |
|
| 60 | + 'slug' => 'normal', |
|
| 61 | + ), |
|
| 62 | + array( |
|
| 63 | + 'name' => esc_html_x( 'Medium', 'font size option label', 'lsx' ), |
|
| 64 | + 'shortName' => esc_html_x( 'M', 'abbreviation of the font size option label', 'lsx' ), |
|
| 65 | + 'size' => 22, |
|
| 66 | + 'slug' => 'medium', |
|
| 67 | + ), |
|
| 68 | + array( |
|
| 69 | + 'name' => esc_html_x( 'Large', 'font size option label', 'lsx' ), |
|
| 70 | + 'shortName' => esc_html_x( 'L', 'abbreviation of the font size option label', 'lsx' ), |
|
| 71 | + 'size' => 30, |
|
| 72 | + 'slug' => 'large', |
|
| 73 | + ), |
|
| 74 | + array( |
|
| 75 | + 'name' => esc_html_x( 'Huge', 'font size option label', 'lsx' ), |
|
| 76 | + 'shortName' => esc_html_x( 'XL', 'abbreviation of the font size option label', 'lsx' ), |
|
| 77 | + 'size' => 40, |
|
| 78 | + 'slug' => 'huge', |
|
| 79 | + ), |
|
| 80 | + ) |
|
| 81 | + ); |
|
| 82 | 82 | |
| 83 | - // Add support for custom color scheme. |
|
| 84 | - add_theme_support( 'editor-color-palette', array( |
|
| 85 | - array( |
|
| 86 | - 'name' => __( 'Strong Blue', 'lsx' ), |
|
| 87 | - 'slug' => 'strong-blue', |
|
| 88 | - 'color' => '#27639e', |
|
| 89 | - ), |
|
| 90 | - array( |
|
| 91 | - 'name' => __( 'Lighter Blue', 'lsx' ), |
|
| 92 | - 'slug' => 'lighter-blue', |
|
| 93 | - 'color' => '#428bca', |
|
| 94 | - ), |
|
| 95 | - array( |
|
| 96 | - 'name' => __( 'Yellow', 'lsx' ), |
|
| 97 | - 'slug' => 'light-yellow', |
|
| 98 | - 'color' => '#f7ae00', |
|
| 99 | - ), |
|
| 100 | - array( |
|
| 101 | - 'name' => __( 'Dark Yellow', 'lsx' ), |
|
| 102 | - 'slug' => 'dark-yellow', |
|
| 103 | - 'color' => '#ab7800', |
|
| 104 | - ), |
|
| 105 | - array( |
|
| 106 | - 'name' => __( 'Green', 'lsx' ), |
|
| 107 | - 'slug' => 'light-green', |
|
| 108 | - 'color' => '#6BA913', |
|
| 109 | - ), |
|
| 110 | - array( |
|
| 111 | - 'name' => __( 'Dark Green', 'lsx' ), |
|
| 112 | - 'slug' => 'dark-green', |
|
| 113 | - 'color' => '#3F640B', |
|
| 114 | - ), |
|
| 115 | - array( |
|
| 116 | - 'name' => __( 'White', 'lsx' ), |
|
| 117 | - 'slug' => 'white', |
|
| 118 | - 'color' => '#ffffff', |
|
| 119 | - ), |
|
| 120 | - array( |
|
| 121 | - 'name' => __( 'Black', 'lsx' ), |
|
| 122 | - 'slug' => 'black', |
|
| 123 | - 'color' => '#000000', |
|
| 124 | - ), |
|
| 125 | - ) ); |
|
| 83 | + // Add support for custom color scheme. |
|
| 84 | + add_theme_support( 'editor-color-palette', array( |
|
| 85 | + array( |
|
| 86 | + 'name' => __( 'Strong Blue', 'lsx' ), |
|
| 87 | + 'slug' => 'strong-blue', |
|
| 88 | + 'color' => '#27639e', |
|
| 89 | + ), |
|
| 90 | + array( |
|
| 91 | + 'name' => __( 'Lighter Blue', 'lsx' ), |
|
| 92 | + 'slug' => 'lighter-blue', |
|
| 93 | + 'color' => '#428bca', |
|
| 94 | + ), |
|
| 95 | + array( |
|
| 96 | + 'name' => __( 'Yellow', 'lsx' ), |
|
| 97 | + 'slug' => 'light-yellow', |
|
| 98 | + 'color' => '#f7ae00', |
|
| 99 | + ), |
|
| 100 | + array( |
|
| 101 | + 'name' => __( 'Dark Yellow', 'lsx' ), |
|
| 102 | + 'slug' => 'dark-yellow', |
|
| 103 | + 'color' => '#ab7800', |
|
| 104 | + ), |
|
| 105 | + array( |
|
| 106 | + 'name' => __( 'Green', 'lsx' ), |
|
| 107 | + 'slug' => 'light-green', |
|
| 108 | + 'color' => '#6BA913', |
|
| 109 | + ), |
|
| 110 | + array( |
|
| 111 | + 'name' => __( 'Dark Green', 'lsx' ), |
|
| 112 | + 'slug' => 'dark-green', |
|
| 113 | + 'color' => '#3F640B', |
|
| 114 | + ), |
|
| 115 | + array( |
|
| 116 | + 'name' => __( 'White', 'lsx' ), |
|
| 117 | + 'slug' => 'white', |
|
| 118 | + 'color' => '#ffffff', |
|
| 119 | + ), |
|
| 120 | + array( |
|
| 121 | + 'name' => __( 'Black', 'lsx' ), |
|
| 122 | + 'slug' => 'black', |
|
| 123 | + 'color' => '#000000', |
|
| 124 | + ), |
|
| 125 | + ) ); |
|
| 126 | 126 | |
| 127 | - $primary_color = 'rgba(39,99,158,1)'; |
|
| 128 | - $secondary_color = 'rgba(247,174,0,1)'; |
|
| 129 | - $tertiary_color = 'rgba(107,169,19,1)'; |
|
| 130 | - $background_color = 'rgba(249,249,249,1)'; |
|
| 127 | + $primary_color = 'rgba(39,99,158,1)'; |
|
| 128 | + $secondary_color = 'rgba(247,174,0,1)'; |
|
| 129 | + $tertiary_color = 'rgba(107,169,19,1)'; |
|
| 130 | + $background_color = 'rgba(249,249,249,1)'; |
|
| 131 | 131 | |
| 132 | - add_theme_support( |
|
| 133 | - 'editor-gradient-presets', |
|
| 134 | - array( |
|
| 135 | - array( |
|
| 136 | - 'name' => __( 'Primary to Secondary', 'lsx' ), |
|
| 137 | - 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)', |
|
| 138 | - 'slug' => 'primary-to-secondary', |
|
| 139 | - ), |
|
| 140 | - array( |
|
| 141 | - 'name' => __( 'Primary to Tertiary', 'lsx' ), |
|
| 142 | - 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
|
| 143 | - 'slug' => 'primary-to-tertiary', |
|
| 144 | - ), |
|
| 145 | - array( |
|
| 146 | - 'name' => __( 'Primary to Background', 'lsx' ), |
|
| 147 | - 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)', |
|
| 148 | - 'slug' => 'primary-to-background', |
|
| 149 | - ), |
|
| 150 | - array( |
|
| 151 | - 'name' => __( 'Secondary to Tertiary', 'lsx' ), |
|
| 152 | - 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
|
| 153 | - 'slug' => 'secondary-to-tertiary', |
|
| 154 | - ), |
|
| 155 | - ) |
|
| 156 | - ); |
|
| 157 | - } |
|
| 132 | + add_theme_support( |
|
| 133 | + 'editor-gradient-presets', |
|
| 134 | + array( |
|
| 135 | + array( |
|
| 136 | + 'name' => __( 'Primary to Secondary', 'lsx' ), |
|
| 137 | + 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $secondary_color ) . ' 100%)', |
|
| 138 | + 'slug' => 'primary-to-secondary', |
|
| 139 | + ), |
|
| 140 | + array( |
|
| 141 | + 'name' => __( 'Primary to Tertiary', 'lsx' ), |
|
| 142 | + 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
|
| 143 | + 'slug' => 'primary-to-tertiary', |
|
| 144 | + ), |
|
| 145 | + array( |
|
| 146 | + 'name' => __( 'Primary to Background', 'lsx' ), |
|
| 147 | + 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $primary_color ) . ' 0%, ' . esc_attr( $background_color ) . ' 100%)', |
|
| 148 | + 'slug' => 'primary-to-background', |
|
| 149 | + ), |
|
| 150 | + array( |
|
| 151 | + 'name' => __( 'Secondary to Tertiary', 'lsx' ), |
|
| 152 | + 'gradient' => 'linear-gradient(135deg, ' . esc_attr( $secondary_color ) . ' 0%, ' . esc_attr( $tertiary_color ) . ' 100%)', |
|
| 153 | + 'slug' => 'secondary-to-tertiary', |
|
| 154 | + ), |
|
| 155 | + ) |
|
| 156 | + ); |
|
| 157 | + } |
|
| 158 | 158 | endif; |
| 159 | 159 | add_action( 'after_setup_theme', 'theme_support' ); |
| 160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @return void |
| 166 | 166 | */ |
| 167 | 167 | function lsx_wpforms_match_button_block( $form_data ) { |
| 168 | - $form_data['settings']['submit_class'] .= ' btn'; |
|
| 169 | - return $form_data; |
|
| 168 | + $form_data['settings']['submit_class'] .= ' btn'; |
|
| 169 | + return $form_data; |
|
| 170 | 170 | } |
| 171 | 171 | add_filter( 'wpforms_frontend_form_data', 'lsx_wpforms_match_button_block' ); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | if ( post_password_required() ) { |
| 9 | - return; |
|
| 9 | + return; |
|
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | $commenter = wp_get_current_commenter(); |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | $html_req = ( $req ? " required='required'" : '' ); |
| 16 | 16 | |
| 17 | 17 | $comment_form_args = array( |
| 18 | - 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 18 | + 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__( 'Comment', 'lsx' ) . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 19 | 19 | |
| 20 | - 'fields' => array( |
|
| 21 | - 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | - '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 20 | + 'fields' => array( |
|
| 21 | + 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__( 'Name', 'lsx' ) . '</label> ' . |
|
| 22 | + ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 23 | + '<input class="form-control" placeholder="' . esc_html__( 'Name', 'lsx' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 24 | 24 | |
| 25 | - 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | - '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 25 | + 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__( 'Email', 'lsx' ) . '</label> ' . |
|
| 26 | + ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 27 | + '<input class="form-control" placeholder="' . esc_html__( 'Email', 'lsx' ) . '" id="email" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 28 | 28 | |
| 29 | - 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | - '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 31 | - ), |
|
| 29 | + 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__( 'Website', 'lsx' ) . '</label>' . |
|
| 30 | + '<input class="form-control" placeholder="' . esc_html__( 'Website', 'lsx' ) . '" id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30"></p>', |
|
| 31 | + ), |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | comment_form( $comment_form_args ); |
@@ -40,47 +40,47 @@ discard block |
||
| 40 | 40 | <section id="comments"> |
| 41 | 41 | <h3> |
| 42 | 42 | <?php |
| 43 | - $comments_number = get_comments_number(); |
|
| 44 | - |
|
| 45 | - if ( '1' === $comments_number ) { |
|
| 46 | - printf( |
|
| 47 | - /* Translators: %s: post title */ |
|
| 48 | - esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 49 | - get_the_title() |
|
| 50 | - ); |
|
| 51 | - } else { |
|
| 52 | - printf( |
|
| 53 | - esc_html( |
|
| 54 | - /* Translators: 1: number of comments, 2: post title */ |
|
| 55 | - _nx( |
|
| 56 | - '%1$s Response to “%2$s”', |
|
| 57 | - '%1$s Responses to “%2$s”', |
|
| 58 | - $comments_number, |
|
| 59 | - 'comments.php', |
|
| 60 | - 'lsx' |
|
| 61 | - ) |
|
| 62 | - ), |
|
| 63 | - esc_html( number_format_i18n( $comments_number ) ), |
|
| 64 | - get_the_title() |
|
| 65 | - ); |
|
| 66 | - } |
|
| 67 | - ?> |
|
| 43 | + $comments_number = get_comments_number(); |
|
| 44 | + |
|
| 45 | + if ( '1' === $comments_number ) { |
|
| 46 | + printf( |
|
| 47 | + /* Translators: %s: post title */ |
|
| 48 | + esc_html_x( 'One Response to “%s”', 'comments.php', 'lsx' ), |
|
| 49 | + get_the_title() |
|
| 50 | + ); |
|
| 51 | + } else { |
|
| 52 | + printf( |
|
| 53 | + esc_html( |
|
| 54 | + /* Translators: 1: number of comments, 2: post title */ |
|
| 55 | + _nx( |
|
| 56 | + '%1$s Response to “%2$s”', |
|
| 57 | + '%1$s Responses to “%2$s”', |
|
| 58 | + $comments_number, |
|
| 59 | + 'comments.php', |
|
| 60 | + 'lsx' |
|
| 61 | + ) |
|
| 62 | + ), |
|
| 63 | + esc_html( number_format_i18n( $comments_number ) ), |
|
| 64 | + get_the_title() |
|
| 65 | + ); |
|
| 66 | + } |
|
| 67 | + ?> |
|
| 68 | 68 | </h3> |
| 69 | 69 | |
| 70 | 70 | <ol class="media-list"> |
| 71 | 71 | <?php |
| 72 | - wp_list_comments( |
|
| 73 | - array( |
|
| 74 | - 'walker' => new LSX_Walker_Comment(), |
|
| 75 | - ) |
|
| 76 | - ); |
|
| 77 | - ?> |
|
| 72 | + wp_list_comments( |
|
| 73 | + array( |
|
| 74 | + 'walker' => new LSX_Walker_Comment(), |
|
| 75 | + ) |
|
| 76 | + ); |
|
| 77 | + ?> |
|
| 78 | 78 | </ol> |
| 79 | 79 | |
| 80 | 80 | <?php |
| 81 | - $comment_pages_count = get_comment_pages_count(); |
|
| 82 | - if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 83 | - ?> |
|
| 81 | + $comment_pages_count = get_comment_pages_count(); |
|
| 82 | + if ( $comment_pages_count > 1 && get_option( 'page_comments' ) ) : |
|
| 83 | + ?> |
|
| 84 | 84 | <nav> |
| 85 | 85 | <ul class="pager"> |
| 86 | 86 | <?php if ( get_previous_comments_link() ) : ?> |
@@ -116,5 +116,5 @@ discard block |
||
| 116 | 116 | <?php lsx_comments_after(); ?> |
| 117 | 117 | |
| 118 | 118 | <?php |
| 119 | - endif; |
|
| 119 | + endif; |
|
| 120 | 120 | ?> |
@@ -8,23 +8,23 @@ discard block |
||
| 8 | 8 | $sidebar_enabled = apply_filters( 'lsx_sidebar_enable', true ); |
| 9 | 9 | |
| 10 | 10 | if ( true !== $sidebar_enabled ) { |
| 11 | - return true; |
|
| 11 | + return true; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $show_on_front = get_option( 'show_on_front' ); |
| 15 | 15 | |
| 16 | 16 | if ( 'page' === $show_on_front && is_front_page() ) { |
| 17 | - $layout = '1c'; |
|
| 18 | - $sidebar = 'home'; |
|
| 17 | + $layout = '1c'; |
|
| 18 | + $sidebar = 'home'; |
|
| 19 | 19 | } else { |
| 20 | - $layout = get_theme_mod( 'lsx_layout', '2cr' ); |
|
| 21 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 22 | - |
|
| 23 | - if ( 'posts' === $show_on_front && is_home() ) { |
|
| 24 | - $sidebar = 'home'; |
|
| 25 | - } else { |
|
| 26 | - $sidebar = 'sidebar-1'; |
|
| 27 | - } |
|
| 20 | + $layout = get_theme_mod( 'lsx_layout', '2cr' ); |
|
| 21 | + $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 22 | + |
|
| 23 | + if ( 'posts' === $show_on_front && is_home() ) { |
|
| 24 | + $sidebar = 'home'; |
|
| 25 | + } else { |
|
| 26 | + $sidebar = 'sidebar-1'; |
|
| 27 | + } |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | if ( '1c' !== $layout ) : ?> |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <ul> |
| 46 | 46 | <?php |
| 47 | - wp_get_archives( array( |
|
| 48 | - 'type' => 'monthly', |
|
| 49 | - ) ); |
|
| 50 | - ?> |
|
| 47 | + wp_get_archives( array( |
|
| 48 | + 'type' => 'monthly', |
|
| 49 | + ) ); |
|
| 50 | + ?> |
|
| 51 | 51 | </ul> |
| 52 | 52 | </aside> |
| 53 | 53 | |
@@ -11,9 +11,9 @@ discard block |
||
| 11 | 11 | $layout = apply_filters( 'lsx_layout', $layout ); |
| 12 | 12 | |
| 13 | 13 | if ( 'posts' === $show_on_front && is_home() ) { |
| 14 | - $sidebar = 'home'; |
|
| 14 | + $sidebar = 'home'; |
|
| 15 | 15 | } else { |
| 16 | - $sidebar = 'sidebar-1'; |
|
| 16 | + $sidebar = 'sidebar-1'; |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if ( '1c' !== $layout ) : ?> |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | <aside id="categories" class="widget widget_categories"> |
| 30 | 30 | <?php |
| 31 | - echo wp_tag_cloud( array( |
|
| 32 | - 'taxonomy' => 'category', |
|
| 33 | - ) ); |
|
| 34 | - ?> |
|
| 31 | + echo wp_tag_cloud( array( |
|
| 32 | + 'taxonomy' => 'category', |
|
| 33 | + ) ); |
|
| 34 | + ?> |
|
| 35 | 35 | </aside> |
| 36 | 36 | |
| 37 | 37 | <?php lsx_sitemap_taxonomy_clouds(); ?> |
@@ -21,11 +21,11 @@ |
||
| 21 | 21 | |
| 22 | 22 | <div class="post-wrapper <?php echo esc_attr( lsx_post_wrapper_class() ); ?>"> |
| 23 | 23 | <?php |
| 24 | - while ( have_posts() ) : |
|
| 25 | - the_post(); |
|
| 26 | - lsx_get_template_part(); |
|
| 27 | - endwhile; |
|
| 28 | - ?> |
|
| 24 | + while ( have_posts() ) : |
|
| 25 | + the_post(); |
|
| 26 | + lsx_get_template_part(); |
|
| 27 | + endwhile; |
|
| 28 | + ?> |
|
| 29 | 29 | </div> |
| 30 | 30 | |
| 31 | 31 | <?php lsx_paging_nav(); ?> |