extendstudio / mesmerize Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
=== Mesmerize === Contributors: horearadu Tags: one-column, right-sidebar, custom-header, custom-menu, custom-logo, full-width-template, theme-options, translation-ready, blog, featured-images, threaded-comments Requires at least: 3.3.0 Tested up to: 4.8 == Description == Mesmerize is an incredibly felxible, multipurpose WordPress theme that can help you create an amazing website easier that ever. It is responsive so it works on mobile devices out of the box. It also provides a separate font page template with a beautiful design. == Documentation == = Customizing Mesmerize = To customize the Mesmerize theme you have to open the Customizer by accessing the Appearance menu -> Customizer. = Using the front page template = Here are the steps you need to follow in order to use the Mesmerize front page template: 1. Access the Pages section in the WP Admin 2. Create a new page and name it 3. In the Page Attributes box on the right side of the screen, set the Template parameter to "Front Page Template" 4. Access the Settings -> Reading section in WP Admin 5. Select "A static page" for the "Front page displays" option 6. Select the page you have created earlier in the "Front page" dropdown menu If you want another page to display the blog index you will need to create one more page and select it in the "Blog" dropdown menu == License == Mesmerize WordPress theme, Copyright (C) 2017 Horea Radu Mesmerize WordPress theme is licensed under the GPL3. Unless otherwise specified, all the theme files and scripts are licensed under GNU General Public License. The exceptions to this license are as follows: * Kirki by Aristeides Stathopoulos - https://github.com/aristath/kirki Licensed under the MIT license (https://opensource.org/licenses/MIT) * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) * Backstretch - http://srobbin.com/jquery-plugins/backstretch/ Copyright (c) 2013 Scott Robbin Licensed under the MIT license (https://opensource.org/licenses/MIT) * modernizr v3.3.1 - https://modernizr.com/download?-setclasses-dontmin Copyright (c) Faruk Ates Paul Irish Alex Sexton Ryan Seddon Patrick Kettner Stu Cox Richard Herrera License - MIT License (https://opensource.org/licenses/MIT) * Hammer.JS - v2.0.8 - http://hammerjs.github.io/ Copyright (c) 2016 Jorik Tangelder; Licensed under the MIT license (https://opensource.org/licenses/MIT) * Spectrum Colorpicker v1.8.0 - https://github.com/bgrins/spectrum Copyright (c) Brian Grinstead License - MIT license (https://opensource.org/licenses/MIT) * Google Fonts: Source Sans Pro (https://fonts.google.com/specimen/Source+Sans+Pro) Licensed under SIL Open Font License, 1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL_web) Copyright © Paul D. Hunt Lato (https://fonts.google.com/specimen/Lato) Licensed under SIL Open Font License, 1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL_web) Copyright © Lukasz Dziedzic Open Sans (https://fonts.google.com/specimen/Open+Sans) Licensed under Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) Copyright © Steve Matteson * Images The following SVG files used in the theme are distributed under the GPL v3 license (https://www.gnu.org/licenses/gpl-3.0.en.html) Source: https://github.com/pojome/elementor/tree/master/assets/shapes assets/separators/arrow-negative.svg assets/separators/arrow.svg assets/separators/book-negative.svg assets/separators/book.svg assets/separators/clouds-negative.svg assets/separators/clouds.svg assets/separators/curve-asymmetrical-negative.svg assets/separators/curve-asymmetrical.svg assets/separators/curve-negative.svg assets/separators/curve.svg assets/separators/drops-negative.svg assets/separators/drops.svg assets/separators/mountains.svg assets/separators/opacity-fan.svg assets/separators/opacity-tilt.svg assets/separators/pyramids-negative.svg assets/separators/pyramids.svg assets/separators/split-negative.svg assets/separators/split.svg assets/separators/tilt-flipped.svg assets/separators/tilt.svg assets/separators/triangle-asymmetrical-negative.svg assets/separators/triangle-asymmetrical.svg assets/separators/triangle-negative.svg assets/separators/triangle.svg assets/separators/wave-brush.svg assets/separators/waves-negative.svg assets/separators/waves-pattern.svg assets/separators/waves.svg assets/separators/zigzag.svg Images used in the theme are distributed under Creative Commons Zero license, http://creativecommons.org/publicdomain/zero/1.0/ Header images * images/home_page_header.jpg Source: http://www.uhdwallpapers.org/2016/11/natural-beauty-of-antelope-canyon-image-desktop-wallpaper.html * images/jeremy-bishop-14593.jpg Source: https://unsplash.com/@tidesinourveins?photo=l61smgU3Y7w - Copyright (c) Jeremy Bishop * images/Mock-up.jpg - Source: http://coverr.co/ ("Mock-up" coverr) * images/photo-1455894127589-22f75500213a.jpeg Source: https://pixabay.com/en/laptop-desk-scene-computer-1246672/ * images/project1.jpg Source: https://unsplash.com/@firmbee?photo=jrh5lAq-mIs - Copyright (c) William Iven The following images are the creation of Horea Radu and are distributed under the Creative Commons Zero License, http://creativecommons.org/publicdomain/zero/1.0/ * assets/images/searchIcon_normalState.png * assets/images/close_icon.png * assets/images/hamburger.png * assets/images/main_button_over.png * assets/images/mainmenu arrow.png * assets/images/mini_arrow.png * assets/images/mini_arrow_large.png * assets/images/mini_circle.png * assets/images/mini_menu.png * assets/images/mobile-back.png * assets/images/mobile-close.png * assets/images/submenu arrow.fw.png
In inc/functions.php
, there's no need for the ternary:
function mesmerize_sanitize_checkbox($val)
{
return (isset($val) && $val == true ? true : false);
}
That can simply be written as:
function mesmerize_sanitize_checkbox( $val ) {
return isset( $val ) && $val;
}
Or:
function mesmerize_sanitize_checkbox( $val ) {
return ! empty( $val );
}
The return value of the expression in either case will be true
or false
.
Just keep this in mind anytime you're returning true
or false
with a ternary. You almost never need it.
This is just an general escaping ticket. I'll continue posting here as I continue on with the review.
The following is a list of file names, followed by line numbers and variables, where escaping is needed.
inc/functions.php
$stings[0]
$words[$i]
esc_html
is used to sanitize input. esc_html
is used to sanitize outputs and not inputs.sanitize_text_field
or mesmerize_sanitize_textfield
The mesmerize_front_page()
function in inc/templates-functions.php
looks like this:
function mesmerize_is_front_page()
{
$is_front_page = (is_front_page() && ! is_home());
return $is_front_page;
}
Eventually, that's used to set the .mesmerize-front-page
body class, which is also used in your customize-preview.js
file.
I wanted to be sure that your check was absolutely correct. There's no inline docs for your code (or any code, really). But, your theme uses a custom page template, which you'd expect a user to use on the front page of the site. However, that template can be used for any page. If the function above is related to the page template also, you'll want to check with is_page_template()
instead.
Your languages/mesmerize.pot
file is missing 150 text strings. I ran the WP translation tool and found 349 strings. The POT file included only has 199 strings.
Check out this post if you don't know how to use the WordPress translation tool: http://ottopress.com/2013/language-packs-101-prepwork/
wp_enqueue_script('gradient-control', get_template_directory_uri() . "/customizer/js/gradient-control.js");
but there is no gradient-control.js file in customizer.js folderMesmerize is almost compatible with Elementor.
But some tiny bugs exist:
Mesmerize Theme prevents to change the color for any icons in elementor. Only gray. It was already been reported here: https://wordpress.org/support/topic/icon-color-with-elementor/ in the next capture the icon should be red
Mesmerize Companion prevents the display of the text module in elementor. Only this module, and only in the front page. But still it's disabling enough to not be able to write on the homepage. It becomes impossible to write in bold, italic, etc.
Make sure excerpt_more
filter does not affect admin side. Your code lines 381 onwards in inc/functions.php should look like this:
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
* a 'Read more' link.
*
* @return string '... Read more'
*/
function mesmerize_excerpt_more( $more ) {
if ( ! is_admin() ) {
return '… <br> <a class="read-more" href="' . esc_url(get_permalink(get_the_ID())) . '">' . esc_html__('Read more', 'mesmerize') . '</a>';
}
}
add_filter('excerpt_more', 'mesmerize_excerpt_more');
Currently, post bylines look something like this:
by Justin Tadlock on General- August 7, 2010 | 0
The "on" text should probably be "in". You post in a category, not on it.
Additionally, your post byline is showing up on attachment pages and looks like this:
by Justin Tadlock on - July 15, 2011 | 0
inc/template-functions.php
line 142, it is missing function print_header_content_holder_class
You need to test all HTML elements within comment text. There's a lot of things that need to be looked at in the screenshot below.
Here's some test code for a comment:
<h2>Headings</h2>
<h1>Header one</h1>
<h2>Header two</h2>
<h3>Header three</h3>
<h4>Header four</h4>
<h5>Header five</h5>
<h6>Header six</h6>
<h2>Blockquotes</h2>
Single line blockquote:
<blockquote>Stay hungry. Stay foolish.</blockquote>
Multi line blockquote with a cite reference:
<blockquote>People think focus means saying yes to the thing you've got to focus on. But that's not what it means at all. It means saying no to the hundred other good ideas that there are. You have to pick carefully. I'm actually as proud of the things we haven't done as the things I have done. Innovation is saying no to 1,000 things. <cite>Steve Jobs - Apple Worldwide Developers' Conference, 1997</cite></blockquote>
<h2>Tables</h2>
<table>
<tbody>
<tr>
<th>Employee</th>
<th class="views">Salary</th>
<th></th>
</tr>
<tr class="odd">
<td><a href="http://example.org/" rel="nofollow">John Saddington</a></td>
<td>$1</td>
<td>Because that's all Steve Job' needed for a salary.</td>
</tr>
<tr class="even">
<td><a href="http://example.org/" rel="nofollow">Tom McFarlin</a></td>
<td>$100K</td>
<td>For all the blogging he does.</td>
</tr>
<tr class="odd">
<td><a href="http://example.org/" rel="nofollow">Jared Erickson</a></td>
<td>$100M</td>
<td>Pictures are worth a thousand words, right? So Tom x 1,000.</td>
</tr>
<tr class="even">
<td><a href="http://example.org/" rel="nofollow">Chris Ames</a></td>
<td>$100B</td>
<td>With hair like that?! Enough said...</td>
</tr>
</tbody>
</table>
<h2>Definition Lists</h2>
<dl><dt>Definition List Title</dt><dd>Definition list division.</dd><dt>Startup</dt><dd>A startup company or startup is a company or temporary organization designed to search for a repeatable and scalable business model.</dd><dt>#dowork</dt><dd>Coined by Rob Dyrdek and his personal body guard Christopher "Big Black" Boykins, "Do Work" works as a self motivator, to motivating your friends.</dd><dt>Do It Live</dt><dd>I'll let Bill O'Reilly will <a title="We'll Do It Live" href="https://www.youtube.com/watch?v=O_HyZ5aW76c" rel="nofollow">explain</a> this one.</dd></dl>
<h2>Unordered Lists (Nested)</h2>
<ul>
<li>List item one
<ul>
<li>List item one
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ul>
<h2>Ordered List (Nested)</h2>
<ol>
<li>List item one
<ol>
<li>List item one
<ol>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
</li>
<li>List item two</li>
<li>List item three</li>
<li>List item four</li>
</ol>
<h2>HTML Tags</h2>
These supported tags come from the WordPress.com code <a title="Code" href="http://en.support.wordpress.com/code/" rel="nofollow">FAQ</a>.
<strong>Address Tag</strong>
<address>1 Infinite Loop
Cupertino, CA 95014
United States</address><strong>Anchor Tag (aka. Link)</strong>
This is an example of a <a title="Apple" href="http://apple.com" rel="nofollow">link</a>.
<strong>Abbreviation Tag</strong>
The abbreviation <abbr title="Seriously">srsly</abbr> stands for "seriously".
<strong>Acronym Tag</strong>
The acronym <acronym title="For The Win">ftw</acronym> stands for "for the win".
<strong>Big Tag</strong>
These tests are a <big>big</big> deal, but this tag is no longer supported in HTML5.
<strong>Cite Tag</strong>
"Code is poetry." --<cite>Automattic</cite>
<strong>Code Tag</strong>
You will learn later on in these tests that <code>word-wrap: break-word;</code> will be your best friend.
<strong>Delete Tag</strong>
This tag will let you <del>strikeout text</del>, but this tag is no longer supported in HTML5 (use the <code><strike></code> instead).
<strong>Emphasize Tag</strong>
The emphasize tag should <em>italicize</em> text.
<strong>Insert Tag</strong>
This tag should denote <ins>inserted</ins> text.
<strong>Keyboard Tag</strong>
This scarcely known tag emulates <kbd>keyboard text</kbd>, which is usually styled like the <code><code></code> tag.
<strong>Preformatted Tag</strong>
This tag styles large blocks of code.
<pre>.post-title {
margin: 0 0 5px;
font-weight: bold;
font-size: 38px;
line-height: 1.2;
}</pre>
<strong>Quote Tag</strong>
<q>Developers, developers, developers...</q> --Steve Ballmer
<strong>Strong Tag</strong>
This tag shows <strong>bold<strong> text.</strong></strong>
<strong>Subscript Tag</strong>
Getting our science styling on with H<sub>2</sub>O, which should push the "2" down.
<strong>Superscript Tag</strong>
Still sticking with science and Isaac Newton's E = MC<sup>2</sup>, which should lift the 2 up.
<strong>Teletype Tag</strong>
This rarely used tag emulates <tt>teletype text</tt>, which is usually styled like the <code><code></code> tag.
<strong>Variable Tag</strong>
This allows you to denote <var>variables</var>.
When loading the primary style.css
file, you should use the core WP get_stylesheet_uri()
function to return the correct URI so that you don't break plugins that filter this.
This should change in inc/functions.php
:
mesmerize_enqueue_style(
$textDomain . '-style',
array(
'src' => get_stylesheet_directory_uri() . '/style.css',
'has_min' => true,
)
);
NOTICE: ...\mesmerize\inc\templates-functions.php:287 - Undefined variable: color
require('...\wp-blog-header.php'), require_once('...\wp-includes\template-loader.php'), include('...\wp-content\themes\mesmerize\index.php'), get_template_part, locate_template, load_template, require('...\mesmerize\template-parts\content.php'), mesmerize_print_post_thumb
The default footer link is set to #
. That either needs to be a real link or not shown by default.
I wasn't entirely sure what to name this ticket, but I primarily wanted to point out that, at times, the theme code is convoluted and tough to understand. I feel a bit like I'm jumping through unnecessary hoops and backtracking through the code to understand what should be simple concepts.
Most of the issues within the theme related to this deal directly with your theme options code. What I'm going to do is run you through an example.
Let's jump to inc/theme-options.php
and take a look at your first action:
add_action('customize_register', 'mesmerize_customize_register', 10, 1);
That's simple enough. You're hooking into the customizer's registration action hook. Let's take a look at that function:
function mesmerize_customize_register($wp_customize)
{
mesmerize_customize_register_controls($wp_customize);
do_action('mesmerize_customize_register', $wp_customize);
}
So, now, we're calling another function from within that function. Additionally, the theme itself now has its own sub-action-hook, which is entirely unnecessary. It doesn't add anything useful. It's no different than the core WP hook except that it's actually less useful to use because anything hooked to it is tethered to customize_register
at the priority of 10
.
And, if you continue following along, things get more nested.
For example, mesmerize_customize_register_controls()
breaks its single responsibility by registering control types, loading some control files, and follows up by calling two more functions for doing other things:
mesmerize_add_sections($wp_customize);
mesmerize_add_general_settings($wp_customize);
And, those functions have their own hooks that are used, particularly mesmerize_add_sections()
, whose own action hook is utilized elsewhere in the theme.
One of the big things here that'd help is that if you simply hooked everything directly into customize_register
. Get rid of your theme's custom action hooks and use customize_register
.
Additionally, try not calling functions from within functions. For example, don't call functions for loading customizer settings and customizer sections from within a function designed to create customizer controls. All those things are separate and have their own responsibilities.
If you don't mind, I'd like to link you to the customizer code from one of my own themes to give you an idea of how I've organized my code. This isn't the only way to do it, but I hope it gives you some ideas. https://github.com/justintadlock/extant/blob/master/inc/class-customize.php
This ticket isn't something you necessarily have to fix to pass any guidelines at .ORG or elsewhere. It's just good practice.
esc_url()
to escape link instead of esc_attr()
esc_url()
to escape $item['thumb']
(img src= value)One of the hardest aspects of reviewing this theme is that, at times, it's impossible to know if a function is doing what it's supposed to be doing. This is simply because there are no inline PHP comments to let me know what something is supposed to do. Now, of course, with some things, this is obvious. However, with other things, it's not so obvious.
Great developers leave comments that explain everything about their code.
I don't care what documentation standard you use or if you use any at all. I just want you to leave docs for your code. But, I will recommend the core WP PHP documentation standard anyway: https://make.wordpress.org/core/handbook/best-practices/inline-documentation-standards/php/
Not only will documenting help those of us reviewing your code, it'll help others find bugs in the future. And, I can't stress this enough, it'll help you find issues and, perhaps more importantly, understand the code 2, 3, 5 years, or more into the future.
And, just a side note to this: If I were looking through the WordPress.org theme review queue, I'd skip your theme and move on to the next one as a reviewer. I know other good reviewers do this too. From a reviewer's perspective, undocumented code is typically not well-written code, and many reviewers don't want to waste their time. But, that's not really the case with your theme. Compared to many other themes, your code looks fairly solid -- just not documented.
Unsplash and Pixabay:
* images/jeremy-bishop-14593.jpg
Source: https://unsplash.com/@tidesinourveins?photo=l61smgU3Y7w - Copyright (c) Jeremy Bishop
* images/photo-1455894127589-22f75500213a.jpeg
Source: https://pixabay.com/en/laptop-desk-scene-computer-1246672/
* images/project1.jpg
Source: https://unsplash.com/@firmbee?photo=jrh5lAq-mIs - Copyright (c) William Iven
I noticed you're using a few images from Unsplash and Pixabay. As of right now, images from those sites are no longer allowed on WordPress.org since both sites changed their licensing to something other than CC0 and incompatible with WordPress.org's policy of 100% GPL compliance.
However, if you do have images from there and the image is definitely under the CC0 license, your .ORG reviewer must have a way of being able verify that.
The easiest course of action is to simply use different images.
Coverr:
* images/Mock-up.jpg -
Source: http://coverr.co/ ("Mock-up" coverr)
The Coverr.com license is incompatible with the GPL: http://coverr.co/license_and_faq They don't specifically mention images there, but one can assume that images fall under the same license.
Here are the bits that make it incompatible:
This license does not include the right to compile Videos from Coverr.co to replicate a similar or competing service.
And:
Am I allowed to sell or redistribute the videos I download from Coverr?
Good question, no you’re not.
It means that you can’t sell the videos and it also means that if you have a service to which providing videos can help - you’re not allowed to offer Coverr videos, either. This applies to Stock Video sites, Website builders, Themes providers, Mobile apps builders and Video editing services.
Horea Radu images:
The following images are the creation of Horea Radu and are distributed under the Creative Commons Zero License, http://creativecommons.org/publicdomain/zero/1.0/
You need to link to a page where the WordPress.org theme reviewer can verify the license of these images.
__()
/_e()
need to be esc_html__()
/esc_html_e()
'title' => esc_html__('Navigation', 'mesmerize'),
wp_kses()
if some html elements are requiredYour screenshot has a good 50/50 shot of being allowed on WordPress.org. It's going to depend on your reviewer to be perfectly honest. If I were your reviewer there, I'd ask you to change it.
The big thing here is that the screenshot is really just used for marketing purposes rather than showing what you can do with the theme. If all that sample content in the screenshot were demo content rather than marketing content, I wouldn't give it a second thought.
Like custom PHP variables, you need to prefix variables in the global JavaScript namespace. In inc/functions.php
(line 258), the settings
variable must be prefixed:
wp_localize_script($textDomain . '-theme', 'settings', $mesmerize_jssettings);
What WP does when using wp_localize_script()
is set your object name as a global variable. So, settings
becomes global.
Also, be sure to change this in any relevant JS files as well.
date('Y')
to date_i18n( __( 'Y', 'textdomain' ) )
in inc/functions.php
line 171the_posts_pagination()
instead of mesmerize_print_pagination()
inc/template-functions.php
function mesmerize_print_pagination
In inc/footer-options/content.php
, you have the mesmerize_footer_templates
filter hook, which allows plugin or child theme authors to overwrite the footer template choices.
This presents a problem in the mesmerize_footer_filter()
function in this line of code:
wp_enqueue_style( $textDomain . '-' . $footer_template . '-css', get_template_directory_uri() . "/assets/css/footer-$footer_template.css", array( $textDomain . "-style" ) );
You're attempting to enqueue a file that doesn't exist if there are custom templates.
That's not going to cause any errors with wp_enqueue_style()
, but I thought I'd point it out from a logic perspective in case you wanted to figure out a more flexible solution in that scenario.
The separator in the front page should keep aspect ratio, else on small devices or small window it vertically stretch and hide the page title.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.