Giter Club home page Giter Club logo

wordpress-theme-customizer-custom-controls's Introduction

WordPress Theme Customizer Custom Controls

The WordPress theme customizer allows you to change the style and functionality of your WordPress theme and see the changes you make in real time without saving the WordPress theme.

Here is a collection of Custom controls you can use on your theme customizer.

So far this collection consists of:

  • Category Dropdown - Creates a dropdown of all the categories on your WordPress theme.
  • Date Picker - Adds a date picker control to the theme customizer.
  • Layout Picker - Adds 3 images of layouts to the page for you to select a new style.
  • Menu Dropdown - Creates a dropdown of all the menus on your WordPress site.
  • Post Dropdown - Creates a dropdown of all the posts on your WordPress site.
  • Tags Dropdown - Creates a dropdown of all tags on your WordPress site.
  • Text Editor - Creates a textbox with the TinyMCE textarea.
  • Textarea - Creates a textarea input field
  • Taxonomy Dropdown - Creates a dropdown of taxonomies ( Usage: see Gist 4538951 )
  • User List Dropdown - Creates a dropdown of users for a role ( Usage: see Gist 4564337 )
  • Google Fonts Dropdown - Create a dropdown to show you the 30 most popular fonts on Google web fonts

wordpress-theme-customizer-custom-controls's People

Contributors

bueltge avatar paulund 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  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

wordpress-theme-customizer-custom-controls's Issues

Controls need public `$type` property

Per Otto's explanation, each custom control should probably declare a unique public $type property.

Example:

if ( ! class_exists( 'WP_Customize_Control' ) )
    return NULL;

class Textarea_Custom_Control extends WP_Customize_Control
{
    public $type = 'textarea';

    /**
     * Render the control's content.
     *
     * Allows the content to be overriden without having to rewrite the wrapper.
     *
     * @since   10/16/2012
     * @return  void
     */
    public function render_content() {

$this->link missing from the post dropdown class

Hi just noticed that the post dropdown doesn't work correctly. It doesn't update on change, and it doesn't save. Seems that the <?php $this->link(); ?> is missing from the select tag. I simply edited so it reads like this on line 26:

<select name="<?php echo $this->id; ?>" <?php $this->link(); ?> id="<?php echo $this->id; ?>">

That seems to fix it.

4.0+ Radio markup

Took forever to figure this out but if anyone is implementing this on WP 4.0+, the markup for the Layout Picker Custom Control needs to have the data-customize-setting-link="radio_setting" data attribute for the Customizer to recognize the change and save the value:

<ul>
   <li class="full-content">
      <label>
      <input type="radio" value="full-content" name="_<?php echo $this->id; ?>" data-customize-setting-link="radio_setting"  />
      <img src="<?php echo $finalImageDirectory; ?>full-content.jpg" alt="Full Content" />
      </label>
   </li>
   <li class="excerpt">
      <label>
      <input type="radio" value="excerpt" name="_<?php echo $this->id; ?>" data-customize-setting-link="radio_setting"  />
      <img src="<?php echo $finalImageDirectory; ?>excerpt.jpg" alt="Excerpt" />
      </label>
   </li>
   <li class="fancy-rollover">
      <label>
      <input type="radio" value="fancy-rollover" name="_<?php echo $this->id; ?>" data-customize-setting-link="radio_setting"  />
      <img src="<?php echo $finalImageDirectory; ?>fancy-rollover.jpg" alt="Fancy Rollover" />
      </label>
   </li>
</ul>

I kinda assume it would be similar for other Custom Controls as well. So watch for that.

Fix for date picker (and maybe more)

Perhaps customizer has been updated in the last 4 years since this set was made. There needs to be added

<?php echo $this->get_link() ?>

to each of the input html so that wordpress knows there is a change and the save button updates, and of course the data gets saved

example for date picker

<label>           
          <span class="customize-date-picker-control"><?php echo esc_html( $this->label ); ?></span>
          <input <?php echo $this->get_link() ?>  type="date" id="<?php echo $this->id; ?>" name="<?php echo $this->id; ?>" value="<?php echo $this->value(); ?>" class="startcamp_datepicker" />                    
        </label>

I'm not making a pull request as it seems to me clear that this is a dead project. I'm leaving this here so others can find out the fix.

Some controls only work in Chrome?

Hi,

I just implemented some custom controls but it seems that some of them only work in Google Chrome but not in Safari or Firefox (like the date picker).

Any idea?

Menu Dropdown Issues

I had to add link(); ?> to the select tag to get the menu dropdown changes to register. $args is not needed in wp_get_nav_menus(). selected() should use $this->value(), not $this->value.

TinyMCE won't load on Text_Editor_Custom_Control

I've added a Text_Editor_Custom_Control to my Customizer using the code below. When I navigate to that section in the Customizer, the field appears with the "Add Media" button plus the "Visual" and "Text" tabs. However, the TinyMCE editor doesn't load. It doesn't add the editor buttons, and the input element itself remains a textarea, instead of being replaced by the iframe. There are no js errors in the console, nor are there any PHP errors (WP_DEBUG is set to 'true').

  $wp_customize->add_section( 'repeated_content' , array(
      'title'      => __( 'Repeated Content', 'sage' ),
  ) );
  $wp_customize->add_setting( 'scholarships' , array(
      'default'     => '',
      'transport'   => 'refresh',
  ) );
  $wp_customize->add_control( new Text_Editor_Custom_Control( $wp_customize, 'scholarships', array(
    'label'      => __( 'Scholarships', 'sage' ),
    'section'    => 'repeated_content',
    'settings'   => 'scholarships',
  ) ) );

wordpress-theme-customizer-custom-controls not working

Hello..
i had download the zip file...
after extracting i put it in theme folder then i include the theme-customizer-demo.php.
after that window display white screen. if i remove it from functions.php then theme working currectly. but wordpress-theme-customizer-custom-controls not woking in mt any theme...
so please help me

Case Sensitivity Disparity

Hey there,
Cool project! =)

I Noticed a couple minor items with this project. The issue is that the folder '/WordPress-Theme-Customizer-Custom-Controls' has uppercase characters and the calls to that directory, from within the project, are all lowercase. I noticed this in the layout picker control and also in the google font select document. So just change the folder to lowercase and that'll do the trick

Multiple instances of wysiwyg

Thanks for this awesome set of examples.

I am trying to implement multiple instances of the WYSIWYG editor in the customizer.

When adding more than one, only one of them actually works. The others get initialized in a very strange fashion:

multiple instances of wysiwyg customizer

You can see in the second instance, it looks like the editors are stacked. It comes along with a JS error that states: Uncaught TypeError: Cannot read property 'settings' of null.

Do you know what may be causing this, and how to work around it?

Thanks,
Evan

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.