Giter Site home page Giter Site logo

wptt / customize-section-button Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aristath/customize-section-button

23.0 23.0 1.0 2.04 MB

Customizer "button" section. Ideal for creating a pro/upsell link in the customizer.

License: GNU General Public License v2.0

JavaScript 39.65% PHP 40.58% SCSS 19.77%

customize-section-button's People

Contributors

aristath avatar dependabot[bot] avatar justintadlock avatar pattonwebz avatar webmandesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

customize-section-button's Issues

Consider escaping button_url with esc_url_raw instead of esc_url for query args.

I'm planning to add an upsell in our theme and add some Google Tag Manager utm query args. Using esc_url() replaces entities for display the & in the url.

I'm not sure this is an issue with GTM, but knowing how finicky things have been in the past I'm leery to have anything but exactly what they ask for in the URL.

I have https://example.com/?utm_source=engine&utm_medium=customizer&utm_campaign=mt-plugins (via add_query_arg)

esc_url gives: https://bizbudding.com/product-category/plugins?utm_source=engine&utm_medium=customizer&utm_campaign=mt-plugins

esc_url_raw gives: https://example.com/?utm_source=engine&utm_medium=customizer&utm_campaign=mt-plugins

Change repo name to "wptrt-customize-section-button"?

Essentially, all this repo does is create a "Button Section". It doesn't technically have to be a "pro" or "upsell" link. The button text and link can literally be anything. Changing it would make it more generic and useful for a wider variety of projects.

Thoughts?

Class not Found Error

I'm always getting this error:

Fatal error: Uncaught Error: Class 'WPTRT\Customize\Section\Button' not found in...

autoload.php is working fine with other Classes and I'm using the default code from the example:

use WPTRT\Customize\Section\Button;

add_action( 'customize_register', function( $manager ) {

	$manager->register_section_type( Button::class );

	$manager->add_section(
		new Button( $manager, 'themeslug_pro', [
			'title'       => __( 'ThemeName Pro', 'themeslug' ),
			'button_text' => __( 'Go Pro',        'themeslug' ),
			'button_url'  => 'http://example.com'
		] )
	);

} );

The strange thing is that only this Button Class is having problems, not other ones.

Build Process

One thing that we should probably decide early on is what system to use for building compiling assets and so on. This project has minimal CSS and JS, so we could get by without anything. But, I'd rather have a consistent method of handling this in any project that includes CSS/JS that we do.

Personally, I'm a fan of Laravel Mix simply because it's super simple to configure: https://laravel-mix.com/ But, I'm open to anything else if someone with more JS and build experience is willing to tackle setting things up.

Goals

We have two goals:

  • Provide raw files that theme authors can import into their own builds if they choose to do so.
  • Provide compiled files that theme authors can simply enqueue.

File organization

Here's how I do things in my projects:

// Raw, uncompiled files:

- /resources
	/js
	/scss (or css)

// Compiled resources:

- /public 
	/js
	/css 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.