Plugin Directory

Changeset 1981747


Ignore:
Timestamp:
11/28/2018 06:49:17 AM (7 years ago)
Author:
betterstudio
Message:

v1.9.5

Location:
better-amp/trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • better-amp/trunk/better-amp.php

    r1977493 r1981747  
    55Description: Add FULL AMP support to your WordPress site.
    66Author: Better Studio
    7 Version: 1.9.4
     7Version: 1.9.5
    88Author URI: http://betterstudio.com
    99*/
     
    5353     * @since 1.0.0
    5454     */
    55     const VERSION = '1.9.4';
     55    const VERSION = '1.9.5';
    5656
    5757
  • better-amp/trunk/includes/classes/class-better-amp-better-rewrite-rules.php

    r1977493 r1981747  
    6060
    6161        add_filter( 'rewrite_rules_array', array( $this, 'fix_end_point_rewrites' ), 100 );
    62     }
    63 
     62        add_filter( 'category_rewrite_rules', array( $this, 'append_category_missing_rules' ), 100 );
     63
     64        add_action( 'init', array( $this, 'append_rewrite_rules_filters' ) );
     65    }
    6466
    6567    /**
     
    144146        return array_merge( $high_level_rules, $rules );
    145147    }
     148
     149    /**
     150     * Append some rewrite rules that add_rewrite_endpoint should do that
     151     *
     152     * todo: add support for custom taxonomies
     153     *
     154     * @param array $rules
     155     *
     156     * @since 1.9.4
     157     * @return array
     158     */
     159    public function append_category_missing_rules( $rules ) {
     160
     161        global $wp_rewrite;
     162
     163        $pattern = trim(
     164            str_replace( $wp_rewrite->rewritecode, $wp_rewrite->rewritereplace, $wp_rewrite->get_category_permastruct() ),
     165            '/'
     166        );
     167        $pattern .= '/' . Better_AMP::SLUG;
     168        $pattern .= '/page/?([0-9]{1,})/?$';
     169
     170        $rules = array_merge( array(
     171            $pattern => $wp_rewrite->index . '?category_name=$matches[1]&paged=$matches[2]&' . Better_AMP::SLUG . '='
     172        ), $rules );
     173
     174        return $rules;
     175    }
     176
     177    /**
     178     * Add some filters to generate rules for custom taxonomies.
     179     *
     180     * @since 1.9.5
     181     */
     182    public function append_rewrite_rules_filters() {
     183
     184        global $wp_rewrite;
     185
     186
     187        if ( ! isset( $wp_rewrite->extra_permastructs ) ) {
     188            return;
     189        }
     190
     191        $skip     = array( 'post_tag', 'post_format', 'category' );
     192        $callback = array( $this, 'append_missing_taxonomy_permastructs' );
     193
     194        foreach ( $wp_rewrite->extra_permastructs as $permastructname => $_ ) {
     195
     196            if ( in_array( $permastructname, $skip ) ) {
     197                continue;
     198            }
     199
     200            if ( ! taxonomy_exists( $permastructname ) ) {
     201                continue;
     202            }
     203
     204            add_filter( $permastructname . '_rewrite_rules', $callback );
     205        }
     206    }
     207
     208
     209    /**
     210     * Append AMP rewrite rules for custom taxonomies.
     211     *
     212     * @param array $rules
     213     *
     214     * @since 1.9.5
     215     * @return array
     216     */
     217    public function append_missing_taxonomy_permastructs( $rules ) {
     218
     219        $amp_rules = array();
     220        $next_page = '/page/?([0-9]{1,})/';
     221
     222        foreach ( $rules as $match => $query ) {
     223
     224            // Do not generate amp end-point rule for feeds
     225            if ( strstr( $query, '&feed=' ) ) {
     226                continue;
     227            }
     228
     229            $e = explode( $next_page, $match );
     230
     231            if ( isset( $e[1] ) ) {
     232
     233                $pattern = $e[0] . '/' . BETTER_AMP::SLUG . $next_page . $e[1];
     234
     235                $amp_rules[ $pattern ] = $query . '&' . BETTER_AMP::SLUG . '=';
     236
     237            } elseif ( substr( $match, - 3 ) === '/?$' ) {
     238
     239                $pattern = substr( $match, 0, - 3 );
     240                $pattern .= '/' . BETTER_AMP::SLUG . '/?$';
     241
     242                $amp_rules[ $pattern ] = $query . '&' . BETTER_AMP::SLUG . '=';
     243            }
     244        }
     245
     246        return array_merge( $amp_rules, $rules );
     247    }
    146248}
  • better-amp/trunk/includes/classes/class-better-amp-content-sanitizer.php

    r1977493 r1981747  
    441441     *
    442442     * @param string $url
    443      *
     443     * @param bool   $strict
     444     *
     445     * @return string transformed none-amp url on success or passed $url otherwise.
    444446     * @since 1.0.0
    445447     *
    446      * @return string transformed none-amp url on success or passed $url otherwise.
    447      */
    448     public static function transform_to_none_amp_url( $url ) {
     448     */
     449    public static function transform_to_none_amp_url( $url, $strict = false ) {
    449450
    450451        if ( ! better_amp_using_permalink_structure() ) {
     
    453454        }
    454455
     456        if ( $strict ) {
     457
     458            $url = self::remove_end_point_amp( $url, $url );
     459            $url = self::remove_start_point_amp( $url, $url );
     460
     461            return $url;
     462        }
     463
    455464        if ( better_amp_url_format() === 'end-point' ) {
    456465
     
    474483    /**
    475484     * @param string $url
     485     * @param mixed  $default
    476486     *
    477487     * @return bool|string none amp url on success or false on error.
    478488     */
    479     public static function remove_start_point_amp( $url ) {
     489    public static function remove_start_point_amp( $url, $default = false ) {
     490
     491        if ( empty( $url ) ) {
     492            return $default;
     493        }
    480494
    481495        $prefix = better_amp_permalink_prefix();
     
    483497        if ( ! preg_match( '#^https?://w*\.?' . self::regex_url() . '/?' . $prefix . '([^/]*)/?(.*?)$#', $url, $matched ) ) {
    484498
    485             return false;
     499            return $default;
    486500        }
    487501
     
    489503        if ( $matched[1] !== Better_AMP::SLUG ) {
    490504
    491             return false;
     505            return $default;
    492506        }
    493507
     
    507521    /**
    508522     * @param string $url
    509      *
    510      * @return bool|string none amp url on success or false on error.
    511      */
    512     public static function remove_end_point_amp( $url ) {
     523     * @param mixed  $default
     524     *
     525     * @return mixed none amp url on success or $default on error.
     526     */
     527    public static function remove_end_point_amp( $url, $default = false ) {
     528
     529        if ( empty( $url ) ) {
     530            return $default;
     531        }
    513532
    514533        if ( ! preg_match( '#^https?://w*\.?' . self::regex_url() . '/?#', $url ) ) {
    515534
    516             return false;
     535            return $default;
    517536        }
    518537
     
    520539
    521540        if ( empty( $parsed['path'] ) ) {
    522             return false;
     541            return $default;
    523542        }
    524543
    525544        if ( basename( $parsed['path'] ) !== Better_AMP::SLUG ) {
    526545
    527             return self::single_post_pagination_none_amp_url( $parsed['path'] );
     546            if ( $transformed = self::single_post_pagination_none_amp_url( $parsed['path'] ) ) {
     547
     548                return $transformed;
     549            }
     550
     551            if ( $transformed = self::pagination_none_amp_url( $parsed['path'] ) ) {
     552
     553                return $transformed;
     554            }
     555
     556            return $default;
    528557        }
    529558
     
    563592
    564593            return home_url( $none_amp_request_url . $page_number );
     594        }
     595
     596        return false;
     597    }
     598
     599
     600    /**
     601     * Remove AMP end-point in paginated pages.
     602     *
     603     * @param string $url_path
     604     *
     605     * @since 1.9.5
     606     * @return bool|string
     607     */
     608    public static function pagination_none_amp_url( $url_path ) {
     609
     610        if ( preg_match( '#(.+)/' . Better_AMP::SLUG . '(/page/\d+/?)#', $url_path, $match ) ) {
     611
     612            return home_url( $match[1] . $match[2] );
    565613        }
    566614
  • better-amp/trunk/includes/classes/class-better-amp-redirect-router.php

    r1977493 r1981747  
    99     * @var self
    1010     *
    11      * @since 1.9.5
     11     * @since 1.9.4
    1212     */
    1313    protected static $instance;
     
    1919     * @var string
    2020     *
    21      * @since 1.9.5
     21     * @since 1.9.4
    2222     */
    2323    protected $query_var;
     
    2929     * @var string
    3030     *
    31      * @since 1.9.5
     31     * @since 1.9.4
    3232     */
    3333    protected $request_url;
     
    3737     * Get singleton instance of the class.
    3838     *
    39      * @since 1.9.5
     39     * @since 1.9.4
    4040     * @return self
    4141     */
     
    5555     * Initialize the module.
    5656     *
    57      * @since 1.9.5
     57     * @since 1.9.4
    5858     */
    5959    public function init() {
     
    8686        $this->request_url = str_replace( bf_get_wp_installation_slug(), '', $_SERVER['REQUEST_URI'] );
    8787
    88         if ( better_amp_url_format() === 'start-point' ) {
    89 
    90             $new_amp_url = $this->transform_to_start_point_url();
     88        if ( ! Better_AMP::get_instance()->amp_version_exists() ) {
     89
     90            $new_url = Better_AMP_Content_Sanitizer::transform_to_none_amp_url( better_amp_get_canonical_url(), true );
     91
     92        } elseif ( better_amp_url_format() === 'start-point' ) {
     93
     94            $new_url = $this->transform_to_start_point_url();
    9195
    9296        } else {
    9397
    94             $new_amp_url = $this->transform_to_end_point_url();
    95         }
    96 
    97         if ( $this->can_redirect_url( $new_amp_url ) ) {
    98 
    99             wp_redirect( $new_amp_url, 301 );
     98            $new_url = $this->transform_to_end_point_url();
     99        }
     100
     101        if ( $this->can_redirect_url( $new_url ) ) {
     102
     103            wp_redirect( $new_url, 301 );
    100104            exit;
    101105        }
     
    105109     * Whether to check ability to redirect user to given url.
    106110     *
    107      * @since 1.9.5
     111     * @since 1.9.4
    108112     *
    109113     * @param $url
  • better-amp/trunk/includes/components/class-better-amp-iframe-component.php

    r1975869 r1981747  
    8686            case 'youtube':
    8787
    88                 $video_id = false;
    89 
    90                 if ( preg_match( '#https?://(?:(?:m|www)\.)?youtube\.com/watch\?(.*)#i', $url, $matched ) ) {
    91 
    92                     parse_str( $matched[1], $vars );
    93 
    94                     if ( ! empty( $vars['v'] ) ) {
    95 
    96                         $video_id = $vars['v'];
    97                     }
    98 
    99                 } elseif ( preg_match( '#https?://(?:(?:m|www)\.)?youtube\.com/embed/([^\/]+)#i', $url, $matched ) ) {
    100 
    101                     $video_id = $matched[1];
    102                 }
    103 
    104                 if ( $video_id ) {
     88                if ( $video_id = self::extract_youtube_video_id( $url ) ) {
    10589
    10690                    $dim = $this->get_iframe_dimension( $html, 'height', 'width', $options );
     
    10892                    return $this->amp_youtube_html( $video_id, $dim[0], $dim[1] );
    10993                }
     94
    11095                break;
    11196
     
    581566        return $output;
    582567    }
     568
     569    /**
     570     * Grab the video ID from given youtube URL.
     571     *
     572     * @param string $url
     573     *
     574     * @since 1.9.5
     575     * @return string video id on success or empty string on failure.
     576     */
     577    public static function extract_youtube_video_id( $url ) {
     578
     579        $video_id = '';
     580
     581        if ( preg_match( '#https?://(?:(?:m|www)\.)?youtube\.com/watch\?(.*)#i', $url, $matched ) ) {
     582
     583            parse_str( $matched[1], $vars );
     584
     585            if ( ! empty( $vars['v'] ) ) {
     586
     587                $video_id = $vars['v'];
     588            }
     589
     590        } elseif ( preg_match( '#https?://(?:(?:m|www)\.)?youtube\.com/embed/([^\/\?\&]+)#i', $url, $matched ) ) {
     591
     592            $video_id = $matched[1];
     593
     594        } elseif ( preg_match( '#https?://(?:(?:m|www)\.)?youtu\.be/([^\/\?\&]+)#i', $url, $matched ) ) {
     595
     596            $video_id = $matched[1];
     597        }
     598
     599        return $video_id;
     600    }
    583601}
    584602
  • better-amp/trunk/includes/functions/theme-functions.php

    r1973642 r1981747  
    10071007    function better_amp_get_canonical_url() {
    10081008
    1009         $canonical = '';
    1010 
    1011         if ( is_singular() ) {
    1012 
    1013             $queried = get_queried_object();
    1014 
    1015             $canonical = get_permalink( $queried->ID );
    1016 
    1017             /**
    1018              * Fix paginated pages canonical.
    1019              */
    1020             if ( get_query_var( 'page' ) > 1 ) {
    1021                 $num_pages = ( substr_count( $queried->post_content, '<!--nextpage-->' ) + 1 );
    1022                 if ( $num_pages && get_query_var( 'page' ) <= $num_pages ) {
    1023                     if ( ! $GLOBALS['wp_rewrite']->using_permalinks() ) {
    1024                         $canonical = add_query_arg( 'page', get_query_var( 'page' ), $canonical );
    1025                     } else {
    1026                         $canonical = user_trailingslashit( trailingslashit( $canonical ) . get_query_var( 'page' ) );
    1027                     }
    1028                 }
    1029             }
    1030 
    1031         } elseif ( is_search() ) {
    1032 
    1033             $search_query = get_search_query();
    1034 
    1035             // Regex catches case when /search/page/N without search term is itself mistaken for search term. R.
    1036             if ( ! empty( $search_query ) && ! preg_match( '|^page/\d+$|', $search_query ) ) {
    1037                 $canonical = get_search_link();
    1038             }
    1039 
    1040         } elseif ( is_front_page() ) {
    1041 
    1042             $canonical = get_bloginfo( 'url' );
    1043 
    1044         } elseif ( is_tax() || is_tag() || is_category() ) {
    1045 
    1046             $term = get_queried_object();
    1047 
    1048             if ( ! empty( $term ) ) {
    1049                 $queried_terms = $GLOBALS['wp_query']->tax_query->queried_terms;
    1050                 /**
    1051                  * Check if term archive query is for multiple terms
    1052                  */
    1053                 if (
    1054                     ! isset( $queried_terms[ $term->taxonomy ]['terms'] ) ||
    1055                     count( $queried_terms[ $term->taxonomy ]['terms'] ) <= 1
    1056                 ) {
    1057                     $term_link = get_term_link( $term, $term->taxonomy );
    1058 
    1059                     if ( $term_link && ! is_wp_error( $term_link ) ) {
    1060                         $canonical = $term_link;
    1061                     }
    1062                 }
    1063             }
    1064 
    1065         } elseif ( is_post_type_archive() ) {
    1066 
    1067             $post_type = get_query_var( 'post_type' );
    1068 
    1069             if ( is_array( $post_type ) ) {
    1070                 $post_type = reset( $post_type );
    1071             }
    1072 
    1073             $canonical = get_post_type_archive_link( $post_type );
    1074 
    1075         } elseif ( is_author() ) {
    1076             $canonical = get_author_posts_url( get_query_var( 'author' ), get_query_var( 'author_name' ) );
    1077         } elseif ( is_archive() ) {
    1078 
    1079             if ( is_date() ) {
    1080                 if ( is_day() ) {
    1081                     $canonical = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
    1082                 } elseif ( is_month() ) {
    1083                     $canonical = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
    1084                 } elseif ( is_year() ) {
    1085                     $canonical = get_year_link( get_query_var( 'year' ) );
    1086                 }
    1087             }
    1088 
    1089         }
    1090 
    1091         return $canonical;
     1009        return home_url( add_query_arg( false, false ) );
    10921010    }
    10931011}
     
    21142032    function better_amp_get_archive_title_fields() {
    21152033
    2116         $icon      = '';
    2117         $pre_title = '';
    2118         $title     = '';
     2034        $icon        = '';
     2035        $pre_title   = '';
     2036        $title       = '';
     2037        $description = '';
    21192038
    21202039        if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) {
    21212040
    21222041            if ( is_product_category() ) {
    2123                 $icon      = '<i class="fa fa-shopping-basket"></i>';
    2124                 $pre_title = better_amp_translation_get( 'browsing_product_category' );
    2125                 $title     = single_term_title( '', false );
     2042
     2043                $icon        = '<i class="fa fa-shopping-basket"></i>';
     2044                $pre_title   = better_amp_translation_get( 'browsing_product_category' );
     2045                $title       = single_term_title( '', false );
     2046                $description = term_description( get_queried_object() );
     2047
    21262048            } elseif ( is_product_tag() ) {
    2127                 $icon      = '<i class="fa fa-shopping-basket"></i>';
    2128                 $pre_title = better_amp_translation_get( 'browsing_product_tag' );
    2129                 $title     = single_term_title( '', false );
     2049
     2050                $icon        = '<i class="fa fa-shopping-basket"></i>';
     2051                $pre_title   = better_amp_translation_get( 'browsing_product_tag' );
     2052                $title       = single_term_title( '', false );
     2053                $description = term_description( get_queried_object() );
     2054
    21302055            } else {
     2056
    21312057                $icon      = '<i class="fa fa-truck"></i>';
    21322058                $pre_title = better_amp_translation_get( 'browsing' );
     
    21352061
    21362062        } elseif ( is_category() ) {
    2137             $icon      = '<i class="fa fa-folder"></i>';
    2138             $pre_title = better_amp_translation_get( 'browsing_category' );
    2139             $title     = single_cat_title( '', false );
     2063
     2064            $icon        = '<i class="fa fa-folder"></i>';
     2065            $pre_title   = better_amp_translation_get( 'browsing_category' );
     2066            $title       = single_cat_title( '', false );
     2067            $description = category_description();
     2068
    21402069        } elseif ( is_tag() ) {
    2141             $icon      = '<i class="fa fa-tag"></i>';
    2142             $pre_title = better_amp_translation_get( 'browsing_tag' );
    2143             $title     = single_tag_title( '', false );
     2070
     2071            $icon        = '<i class="fa fa-tag"></i>';
     2072            $pre_title   = better_amp_translation_get( 'browsing_tag' );
     2073            $title       = single_tag_title( '', false );
     2074            $description = tag_description();
     2075
    21442076        } elseif ( is_author() ) {
    2145             $icon      = '<i class="fa fa-user-circle"></i>';
    2146             $pre_title = better_amp_translation_get( 'browsing_author' );
    2147             $title     = '<span class="vcard">' . get_the_author() . '</span>';
     2077
     2078            $icon        = '<i class="fa fa-user-circle"></i>';
     2079            $pre_title   = better_amp_translation_get( 'browsing_author' );
     2080            $title       = '<span class="vcard">' . get_the_author() . '</span>';
     2081            $description = get_the_author_meta( 'description' );
     2082
    21482083        } elseif ( is_year() ) {
     2084
    21492085            $icon      = '<i class="fa fa-calendar"></i>';
    21502086            $pre_title = better_amp_translation_get( 'browsing_yearly' );
    21512087            $title     = get_the_date( _x( 'Y', 'yearly archives date format', 'better-amp' ) );
     2088
    21522089        } elseif ( is_month() ) {
     2090
    21532091            $icon      = '<i class="fa fa-calendar"></i>';
    21542092            $pre_title = better_amp_translation_get( 'browsing_monthly' );
    21552093            $title     = get_the_date( _x( 'F Y', 'monthly archives date format', 'better-amp' ) );
     2094
    21562095        } elseif ( is_day() ) {
     2096
    21572097            $icon      = '<i class="fa fa-calendar"></i>';
    21582098            $pre_title = better_amp_translation_get( 'browsing_daily' );
    21592099            $title     = get_the_date( _x( 'F j, Y', 'daily archives date format', 'better-amp' ) );
     2100
    21602101        } elseif ( is_tax( 'post_format' ) ) {
     2102
    21612103            if ( is_tax( 'post_format', 'post-format-aside' ) ) {
     2104
    21622105                $icon      = '<i class="fa fa-pencil"></i>';
    21632106                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21642107                $title     = better_amp_translation_get( 'asides' );
     2108
    21652109            } elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
     2110
    21662111                $icon      = '<i class="fa fa-camera"></i>';
    21672112                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21682113                $title     = better_amp_translation_get( 'galleries' );
     2114
    21692115            } elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
     2116
    21702117                $icon      = '<i class="fa fa-camera"></i>';
    21712118                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21722119                $title     = better_amp_translation_get( 'images' );
     2120
    21732121            } elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
     2122
    21742123                $icon      = '<i class="fa fa-video-camera"></i>';
    21752124                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21762125                $title     = better_amp_translation_get( 'videos' );
     2126
    21772127            } elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
     2128
    21782129                $icon      = '<i class="fa fa-quote-' . better_amp_direction() . '"></i>';
    21792130                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21802131                $title     = better_amp_translation_get( 'quotes' );
     2132
    21812133            } elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
     2134
    21822135                $icon      = '<i class="fa fa-link"></i>';
    21832136                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21842137                $title     = better_amp_translation_get( 'links' );
     2138
    21852139            } elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
     2140
    21862141                $icon      = '<i class="fa fa-refresh"></i>';
    21872142                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21882143                $title     = better_amp_translation_get( 'statuses' );
     2144
    21892145            } elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
     2146
    21902147                $icon      = '<i class="fa fa-music"></i>';
    21912148                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21922149                $title     = better_amp_translation_get( 'audio' );
     2150
    21932151            } elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
     2152
    21942153                $icon      = '<i class="fa fa-coffee"></i>';
    21952154                $pre_title = better_amp_translation_get( 'browsing_archive' );
    21962155                $title     = better_amp_translation_get( 'chats' );
    21972156            }
     2157
    21982158        } elseif ( is_post_type_archive() ) {
    2199             $icon      = '<i class="fa fa-archive"></i>';
    2200             $pre_title = better_amp_translation_get( 'browsing_archive' );
    2201             $title     = post_type_archive_title( '', false );
     2159
     2160            $icon        = '<i class="fa fa-archive"></i>';
     2161            $pre_title   = better_amp_translation_get( 'browsing_archive' );
     2162            $title       = post_type_archive_title( '', false );
     2163            $description = function_exists( 'get_the_post_type_description' ) ?
     2164                get_the_post_type_description() : '';
    22022165        } elseif ( is_tax() ) {
    22032166
    2204             $tax = get_taxonomy( get_queried_object()->taxonomy );
    2205 
    2206             $icon      = '<i class="fa fa-archive"></i>';
    2207             $pre_title = better_amp_translation_get( 'browsing_archive' );
    2208             $title     = sprintf( __( '%1$s: %2$s', 'beetter-amp' ), $tax->labels->singular_name, single_term_title( '', false ) );
     2167            $tax         = get_taxonomy( get_queried_object()->taxonomy );
     2168            $icon        = '<i class="fa fa-archive"></i>';
     2169            $pre_title   = better_amp_translation_get( 'browsing_archive' );
     2170            $title       = sprintf( __( '%1$s: %2$s', 'beetter-amp' ), $tax->labels->singular_name, single_term_title( '', false ) );
     2171            $description = term_description();
     2172
    22092173        } else {
     2174
    22102175            $icon      = '<i class="fa fa-archive"></i>';
    22112176            $pre_title = better_amp_translation_get( 'browsing' );
     
    22132178        }
    22142179
    2215 
    2216         return compact( 'icon', 'pre_title', 'title' );
     2180        return compact( 'icon', 'pre_title', 'title', 'description' );
    22172181    }
    22182182}
  • better-amp/trunk/readme.txt

    r1977493 r1981747  
    5151
    5252== Changelog ==
     53
     54= 1.9.5 =
     55- Added: Category description support in archive page (all taxonomies)
     56
     57- Improved: Do not view amp when it’s not enabled.
     58- Improved: Added support for custom taxonomies in end-point.
     59
     60- Fixed: Youtube embedded video with short link youtu.be
     61- Fixed: WooCommerce tag archive page header style.
     62
    5363
    5464= 1.9.4 =
  • better-amp/trunk/template/css/archive.css

    r1600346 r1981747  
    1212    position: relative;
    1313}
    14 .archive-page-header .pre-title{
     14.archive-page-header .pre-title,
     15.archive-page-header .archive-description{
    1516    font-size: 14px;
    1617    margin-bottom: 3px;
     
    2627    margin-right: 10px;
    2728}
     29
     30.archive-page-header h1 {
     31    font-size: 30px;
     32}
     33
     34.archive-page-header h1 .fa {
     35    margin-right: 8px;
     36}
     37
     38body.rtl .archive-page-header h1 .fa {
     39    margin-left: 8px;
     40    margin-right: 0;
     41}
  • better-amp/trunk/template/css/archive.min.css

    r1600346 r1981747  
    1 .archive-page-header{padding:15px 18px 11px;margin:0 0 15px;background:#fff;font-family:Roboto;font-size:25px;font-weight:500;border:1px solid #dcdcdc;position:relative}.archive-page-header .pre-title{font-size:14px;margin-bottom:3px;font-weight:400;color:#868686}.archive-page-header .archive-title{margin:0;font-size:26px;text-transform:capitalize}.archive-page-header .archive-title .fa{margin-right:10px}
     1.archive-page-header{padding:15px 18px 11px;margin:0 0 15px;background:#fff;font-family:Roboto;font-size:25px;font-weight:500;border:1px solid #dcdcdc;position:relative}.archive-page-header .archive-description,.archive-page-header .pre-title{font-size:14px;margin-bottom:3px;font-weight:400;color:#868686}.archive-page-header .archive-title{margin:0;font-size:26px;text-transform:capitalize}.archive-page-header .archive-title .fa{margin-right:10px}.archive-page-header h1{font-size:30px}.archive-page-header h1 .fa{margin-right:8px}body.rtl .archive-page-header h1 .fa{margin-left:8px;margin-right:0}
  • better-amp/trunk/template/taxonomy-product_tag.php

    r1594085 r1981747  
    22
    33better_amp_get_header();
     4
     5better_amp_enqueue_block_style( 'archive', 'css/archive' );
    46
    57better_amp_template_part( 'views/archive/title' );
  • better-amp/trunk/template/views/archive/title.php

    r1594085 r1981747  
    2525    echo '<h1 class="archive-title">', $title['icon'], $title['title'], '</h1>';
    2626
     27    if ( ! empty( $title['description'] ) ) {
     28
     29        echo '<div class="archive-description">', $title['description'], '</div>';
     30    }
    2731    ?>
    2832</header>
Note: See TracChangeset for help on using the changeset viewer.