Tag Info

New answers tagged

1

Seems like core just needs a better way to handle backwards compatibility with Plupload at the WordPress level :) You as a plugin developer shouldn't have to worry about that, your usage looks fair, given that there currently is no other way to obtain that default settings array. I've opened #27763 to address this and some other compatibility issues with ...


0

Thanks for posting your link. I'm sorry to say, but the theme you bought is no good, and you should really contact the author for a refund. Your scripts are loaded in the <body> tag, and some scripts even load before the jquery library. It is no use to even try and salvage the theme. You will end up mad. Here is a screenshot of the html Original ...


1

I'll try and answer this for you based on the limited information you've provided... When using woocommerce, you also need to define the various image sizes for your products in the dashboard at Woocommerce > Settings > Product Image Sizes Whatever size you choose should match the sizes in your Media Library settings, but you've already said that these are ...


1

This can easily be done with body classes and conditional statements. Looking at your question, you will have a custom 'page.php' and 'single.php' for what you are doing. For this purpose, I'll call them 'page-custom.php' and 'single-custom.php' We can now assign a body class to these pages with the following function function mytheme_body_classes( ...


0

Instead of using jQuery to update the value of the custom input, use the wp.customize object’s set() function (found in customize-base.js): wp.customize(key, function(obj) { obj.set(_new_value); } ); Where key is the setting, and _new_value is the updated value. Also, worth noting, in the class that extends WP_Customize_Control, make sure to use ...


2

functions.php unfortunately is very ingrained part of theme load process. If your architecture is flexible enough you should be able to conditionally unhook related bits. Even if it's not — templates give you complete control over page output. You could go as far as completely omitting wp_head()/wp_footer() calls and handle assets (semi-)manually if that is ...


0

take a look here: http://codex.wordpress.org/Function_Reference/wp_localize_script First add Data in your php file // Register the script first. wp_register_script( 'some_handle', 'path/to/myscript.js' ); // Now we can localize the script with our data. $translation_array = array( 'some_string' => __( 'Some string to translate' ), 'a_value' => '10' ); ...


1

You should remove the link from the anchor tag: <a class="button" href="#" style="background-color:white;color:black;"> <strong>Submit</strong> </a> Then your jQuery part should be: $('a.button').click(function(event){ event.preventDefault(); //your ajax gets here: jQuery.ajax({ type:"post", ...


0

Well, if you are intent on collecting the title of a post and inserting it into a hidden field, then you could use Javascript to easily grab the info. I enjoy using jQuery, so here is something you could do: 1) place the Title into a data attribute on the element that you want the user to click on. <div class="event-name"> <p ...


0

EDIT http://www.example.com/playlist.xml is not valid playlist url. Also you are missing " at the end of the url. Please refer to http://www.longtailvideo.com/support/jw-player/28850/using-the-javascript-api for jwplayer usage. You also need to call jwplayer().play() Try this, wp_register_script('myJW', get_bloginfo('template_url') . ...


1

You need to properly enqueue your script. You should hook your script to the function enqueue_custom_script() { wp_register_script('myJW', get_bloginfo('template_url') . '/jwplayer.js'); wp_enqueue_script('myJW'); } add_action( 'wp_enqueue_scripts', 'enqueue_custom_script' );


3

The text goes white when the id attribute ($editor_id) contains []. They are not allowed here. Make sure the second argument for wp_editor does not contain [], and the text becomes visible again. I have reported that regression with a test case on ticket #26778. To use brackets in the name attribute, use textarea_name in the settings parameter. Example ...


1

I created and managed my own custom meta fields for years and I can tell you it was always a headache. I frequently came up against stumbling blocks like yours and ended up banging my fist against the wall. I've also worked on quite a few sites which had been flooded with plugins, sometimes so many that it soured me on plugins altogether and I resolved to ...


0

I had a similar problem using custom field values in a widget that used JavaScript. I wrote a tutorial explaining it. Try this code: <?php global $post; $cf = get_post_meta($post->ID, 'my_custom_field', true); ?> <button onclick="window.open(<?php echo json_encode($cf); ?>);">Click me</button>


1

The plugin that you are using has a bug. I would strongly suggest for you to call the plugin author. Here is the bugs; Notice: has_cap was called with an argument that is deprecated since version 2.0! Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead. in C:\xampp\htdocs\wordpress\wp-includes\functions.php on ...


1

As the names themselves seem to state, one of those hooks to the customize-controls, the other to the customize-preview. They are not the same and you could in fact use them both, for different purposes. If you're hooking in JS code to affect the controls in the customizer, then you would want to use customize_controls_enqueue_scripts. If you're hooking in ...


0

The issue is that your script is doing a replace, but really what you want is to set the window location: Change your redirects from: window.location.replace(encodeURIComponent("http://www.url.com/?customposttype=postslug")) to window.location = "http://www.url.com/?customposttype=postslug"; And it should work properly.


0

I'm writing a WP plugin that might be called on any page The issue here is that you want to be able to call the function on any page. And if you're distributing the plugin, you will either require users to add code or you should provide a settings page on which the user can choose on which page the file should load. If you're developing the plugin for ...


0

If your scripts can be printed in the footer add the enqueue to the definition of getDeck, with the final argument set to true. I.e in your plugin file function getDeck( $deckId ) { wp_enqueue_script( $handle, $src, $deps, $ver, true ); //do other stuff }


0

While you can approach it with "what template is loaded", WP isn't engineered for such logic. Template load is result of logic processing, not the other way around. You should check out Conditional Tags and determine which logical check applies to your situation. Other than that you should be: running script-related logic on appropriate ...


0

The most obvious solution that comes to mind, is actually en-queueing the script within the file needed, or within a function that gets called only in that file. If wp_enqueue_script() is run after wp_head(), it gets en-queued in the footer.



Top 50 recent answers are included