Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postMessage and image field #957

Closed
manuelmoreale opened this issue May 2, 2016 · 5 comments
Closed

postMessage and image field #957

manuelmoreale opened this issue May 2, 2016 · 5 comments

Comments

@manuelmoreale
Copy link
Contributor

Issue description:

Not sure this is technically a bug but would be useful to have the image field to output the url of the image inside the src attribute when the transport is set to postMessage
Currently is outputting something like this <img src=''>imagePath</img> which is not helpful 😊

Version used:

2.3.2

@aristath
Copy link
Contributor

aristath commented May 2, 2016

have you tried using the value_pattern argument in output?

@manuelmoreale
Copy link
Contributor Author

Isn't the value pattern available only with the output argument? The output itself is working fine, I'm just talking about the live preview

@aristath
Copy link
Contributor

aristath commented May 2, 2016

If you're currently online we can talk about this in detail on gitter... easier that way: https://gitter.im/aristath/kirki

aristath added a commit that referenced this issue May 2, 2016
@aristath
Copy link
Contributor

aristath commented May 2, 2016

Fixed in c505bad by adding a new attr argument:

Kirki::add_field( 'the', array(
    'settings'    => 'the_logo',
    'type'        => 'image',
    'section'     => $section,
    'priority'    => 50,
    'label'       => __( 'Content : Logo or Avatar', 'the' ),
    'description' => 'This image will be displayed at the top of the hidden about section on the right-hand side of the screen.',
    'tooltip'     => 'You should put a nice image of yourself or a rad logo.',
    'default'     => THE_DEFAULT_LOGO,
    'transport'   => 'postMessage',
    'js_vars'     => array(
        array(
            'element'  => '.the-logo',
            'function' => 'html',
            'attr'     => 'src',
        ),
    )
));

@rinkuyadav999
Copy link
Contributor

Cool but it is missing in docs @ https://kirki.org/docs/arguments/js_vars.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants