Giter VIP home page Giter VIP logo

customizer-library's People

Contributors

devinsays avatar m-e-h avatar natewr avatar robneu avatar tivnet 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

customizer-library's Issues

Handle ads option

Devin,
How do you handle option for ads? If I use textarea with default sanitization, it will strip the ads code, for example from adsense?

My solution for now is just create custom sanitization with 'unsafe' filter, using stripslashes only. I need second opinion about this.

Thank you

Problem when saving choices control

Hi Devin,
I've strange experience with the choices control(select, radio), when saving it, it didn't worked

choices control

Here's my code

// Radio Button
$section = $prefix . 'radio';

$sections[] = array(
    'id'          => $section,
    'title'       => __( 'Radio Section', 'standard' ),
    'priority'    => 45,
    'panel'       => $test_panel,
);
$options['test-radio'] = array(
    'id'           => $prefix . 'test_radio',
    'label'        => __( 'This is title', 'standard' ),
    'description'  => __( 'This is description', 'standard' ),
    'section'      => $section,
    'type'         => 'radio',
    'default'      => 'options2',
    'choices'      => array(
        'options1' => 'Option 1',
        'options2' => 'Option 2',
        'options3' => 'Option 3'
    )
);

I tried to check the sanitization code customizer_library_sanitize_choices and tried to remove whole code except return $value; and the issue disappear(saving works). Do you know what is wrong?

Thank you.

Q: Initializing Default Options

This is more a question, as I'm not understanding how to actually set initial default options. I have a default set in the customizer library file, and I see my checkbox for instance is set to default to checked.

But on theme install and activation it is not setting the default of that option to checked into the database. So any conditionals I've written in a template file for that option dont work. If I go in and deselect / reselect it works fine. So I'm somehow missing how to initialize my theme with the defaults set.

I'd appreciate any advice anyone could give me on this. I have a deadline, unfortunately, to finish this theme before xmas - so I'll probably have to just hack my template part a bit to make it work. But I'd love to figure this out and refactor.

Font "Copse" Not Updating

Hi Devin,

I'm not having any trouble with any of the Google Fonts except for "Copse". I've had a look through the fonts.php extension but I'm not seeing why that one font would be singled out.

Hook Additional Options onto Action

I'm sorry about title, I have no idea what is the best title for my question.

I'm trying to split the customizer option into seperated files, so I tried to added 'hook' in the middle of code, somethin like this

function standard_customizer_register() {

    // Stores all the controls that will be added
    $options = array();

    // Stores all the sections to be added
    $sections = array();

    // Stores all the panels to be added
    $panels = array();

    // Adds the sections to the $options array
    $options['sections'] = $sections;

    // Hook to add the custom customizer.
    do_action( 'standard_register_customizer', $options, $sections, $panels );

    // Adds the sections to the $options array
    $options['sections'] = $sections;

    // Adds the panels to the $options array
    $options['panels'] = $panels;

    $customizer_library = Customizer_Library::Instance();
    $customizer_library->add_options( $options );

}
add_action( 'init', 'standard_customizer_register' );

then I called the file and hook in to add the panels/sections.

$path = trailingslashit( get_template_directory() ) . 'admin/panels/';
require_once( $path . 'general.php' );

general.php

function standard_customizer_general_panel( $sections, $panels, $options) {

    // Panel ID
    $panel = 'panel';

    $panels[] = array(
        'id' => $panel,
        'title' => __( 'General', 'Standard' ),
        'priority' => 10
    );

    // Logo
    $section = 'logo';

    $sections[] = array(
        'id' => $section,
        'title' => __( 'Image Example', 'demo' ),
        'priority' => '30',
        'description' => __( 'Example section description.', 'demo' ),
        'panel' => $panel
    );
    $options['logo'] = array(
        'id' => 'logo',
        'label'   => __( 'Logo', 'demo' ),
        'section' => $section,
        'type'    => 'image',
        'default' => ''
    );

}
add_action( 'standard_register_customizer', 'standard_customizer_general_panel', 10, 3 );

But it didn't worked. My question:

  1. Is it possible to split the options files?
  2. Am I missing something in the code?

Thank you.

Support Panels implementation

WP 4.0 added Panels to the customizer as a way to group sections. Would like to see this support added to the library.

Add custom control for additional html & help text

Add an additional control that would allow for additional html - e.g. A heading or description, a line, etc.

An example would be something like this: http://coreymckrill.com/blog/2014/01/09/adding-arbitrary-html-to-a-wordpress-theme-customizer-section/

I believe this is the last piece keeping folks from embracing the customizer for all theme options - as currently we have no good way add additional help text and communicate to end users. Corey's article above is exactly the situation I just ran into. Panels might help, but those are not in the library either at this time.

Add composer support

Rather than using as a submodule, it would be great to include it via Composer.

radio select options as images

I'm trying to figure out how to use images for my radio select options, like for instance when you are choosing layout options for a sidebar placement. Is this supported?

Get default helper function not displaying default

I'm having some trouble working out why the default helper function isn't returning my option defaults. Example usage:

$options['home-posts-section-title'] = array(
    'id'             => 'home-posts-section-title',
    'label'        => __( 'Section Title', 'themename' ),
    'section'     => $section,
    'type'          => 'textarea',
    'default'      => __( 'Latest News', 'themename' ),
    'transport'   => 'postMessage'
);

The setting is being called like this:

echo esc_attr( get_theme_mod( 'home-posts-section-title', customizer_library_get_default( 'home-posts-section-title' ) ) );

The default displays in the customizer screen but not on the live site.

Choosing files already uploaded

Hello @devinsays, is there a way to choose files already uploaded? I am using a Logo setting in my client project. In case the logo image is removed, we have to upload a image again. Similar to Options framework is there no way to allow users to pick a image already uploaded?

Can't clear color values

If you have an optional color field and set a color value (hex number), the field can no longer be empty.

For exampleI set the field to white (#ffffff) and save. I then click "clear" and save. Value is still white. If I delete the value from the field manually and save the value will remain white. Once a value is set there is no way to allow the field to not have a value.

Using with a plugin

Hello Devin,
Thanks for sharing this.

One thing I noticed was lack of tag to this project. I'm guessing this is because of you are still experimenting.

I am including this code within my plugin https://github.com/hchouhan/WordPress-for-My-Clients (also hosted at WordPress.org) to allow easier update for my client projects. My project already has submodule, and I don't want to add another submodule within a submodule.

Just wanted to know if you plan to tag this project soon, as it would be easier to compare and update in future.

Can't add two or more sections to a custom panel

Been trying for hours to add a second section to a custom panel. Can't figure out how to make it work.

I've tried:

    $panel = 'panel';

    $panels[] = array(
        'id' => $panel,
        'title' => __( 'Panel Examples', 'demo' ),
        'priority' => '100'
    );

    $section = 'panel-section';

    $sections[] = array(
        'id' => $section,
        'title' => __( 'Panel Section', 'demo' ),
        'priority' => '10',
        'panel' => $panel
    );

    $options['example-panel-text'] = array(
        'id' => 'example-panel-text',
        'label'   => __( 'Example Text Input', 'demo' ),
        'section' => $section,
        'type'    => 'text',
    );  

    $section_two = 'panel-section-two';

    $sections[] = array(
        'id' => $section_two,
        'title' => __( 'Panel Section Two', 'demo' ),
        'priority' => '10',
        'panel' => $panel
    );  

    $options['example-panel-text'] = array(
        'id' => 'example-panel-text',
        'label'   => __( 'Example Text Input', 'demo' ),
        'section' => $section_two,
        'type'    => 'text',
    );

and:

    $panel = 'panel';

    $panels[] = array(
        'id' => $panel,
        'title' => __( 'Panel Examples', 'demo' ),
        'priority' => '100'
    );

    $section = 'panel-section';

    $sections[] = array(
        'id' => 'SectionOne',
        'title' => __( 'Panel Section', 'demo' ),
        'priority' => '10',
        'panel' => $panel
    );

    $sections[] = array(
        'id' => 'SectionTwo',
        'title' => __( 'Panel Section Two', 'demo' ),
        'priority' => '20',
        'panel' => $panel
    );      

    $options['example-panel-text'] = array(
        'id' => 'example-panel-text',
        'label'   => __( 'Example Text Input', 'demo' ),
        'section' => 'SectionOne',
        'type'    => 'text',
    );

    $options['example-panel-text'] = array(
        'id' => 'example-panel-text',
        'label'   => __( 'Example Text Input', 'demo' ),
        'section' => 'SectionTwo',
        'type'    => 'text',
    );  

In both cases, the second section overwrites the first one, and only the second one shows up. What am I doing wrong?

Anyway to add classes to each option

Can extra classes be added to each option. Wanting to create half and quarter width options to make a cleaner feel. I can so with by targeting the built in css now, but have to do each one by one. would to simplify make it more streamlined and add a single class for the shorter options.

Style missing

Hi,
The css folder and css file is missing here.
Please update the version.

Sanitization callback: Theme-Check plugin "required" notice

I'm getting the following required notice from the theme check plugin:

REQUIRED: Found a Customizer setting that did not have a sanitization callback function. Every call to the add_setting() method needs to have a sanitization callback function passed.

It doesn't give any more details other than that.

Adding a wysiwyg editor in the customizer-library

Hi Devin,
There is no editor in the theme customizer library. Is there any option to add there? I tried to add an option but is didn't worked. I found like that here https://github.com/paulund/wordpress-theme-customizer-custom-controls but not tried since I am comfortable with Options framework

This is not an issue but what I think if this could be added. As sometimes we may not work with plugin or theme options , for some projects we may think to just add some Theme customizer options.

Thanks in advance

Add comprehensive examples to README.md

Suggestion: add full examples to README.md that describe all possible arguments for the following functions/variables (args/values I noticed are missing are in parenthesis - there could be more as well):

  • $sections[]
  • $options[] (priority)
  • Customizer_Library_Styles()->add() (media)

Are there others you know of?

Output media queries

Awesome work, Devin! I'm loving this. Question: can I output media queries using Customizer_Library_Styles()->add()? I'd love to be able to specify media query specific output for something like a retina and non-retina logo. Is this possible?

Thanks!

Default Options - any way to call after theme setup

I know we talked on another issue about this, and you said it was best not to set the defaults in the database. However for my end users - they end up activating a theme where nothing is set and being completely overwhelmed and not knowing where to start. If the defaults were actually set upon activating the theme, this would not be a problem.

So, is there any workaround? A way to make take just the few options that really need to be set and put them in a function for after setup theme?

Image ID instead of URL

Hi Devin :)

Thanks for your library. Would you be keen to add another control for WP_Customize_Media_Control so we could have an easy way of getting an attachment ID? Looks like it's ready to go in this PR.

Add option for repeatable fields

My first thought was about multiple-images field useful for bacground sliders, etc. But maybe more general solution would be even nicer: repeatable fields.

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.