0
votes
1answer
22 views

Need to hide an element depending on date and post category

I've been racking my brains for a few days trying to figure this out. I'm using WP Voting on my site. I need to create a script in single.php that will remove the div that contains the voting widget ...
0
votes
0answers
17 views

Can You Require the Use of JavaScript in a WordPress Plugin?

I commonly use Mozilla Firefox for testing changes I make for a plugin that I'm developing. I also have the NoScript addon installed because it is also my main browser. I noticed that the ...
2
votes
1answer
100 views

How to prevent loading of all plugin's resources?

Wordpress is loading all client resources of all plugins, not just the plugin of interest. It may make sense to load jqery globally but it makes no sense to load all other plugin's Javascript in a ...
0
votes
0answers
334 views

Add async script

I am working on a plugin that has to inject a script on pages (something like RefTagger), which would be easy using wp_enqueue_script, but there are two reasons I cannot do that: the script tag has to ...
0
votes
1answer
44 views

Why this plugin is not working?

I am testing jQuery in my wordpress plugin. Two files 1. main_plugin.php 2. js_plugin.js (Both in the same directory HelloWorld). CODE: PHP FILE: <?php /* Plugin Name: jQuery Test Plugin Plugin ...
1
vote
2answers
56 views

add javascript files only when plugin is called?

I'm writing a WP plugin that might be called on any page using a simple function call:getDeck(Deck_id) - and i'd like to add my javascript files on pages where this function is called ONLY, as ...
0
votes
1answer
75 views

Ajax, jQuery and Wordpress

I'm having trouble getting AJAX and jQuery to work with WP, and wondering if someone can point me in the right direction. I have a form, and I want to pass the data from the form to a PHP function, ...
0
votes
1answer
218 views

Is there a WordPress plugin to design WebGL? [closed]

I have been working as a WordPress designer/developer for some time and now I've decided to write a plugin myself. I also have some OpenGL experience (not web based). I was thinking is it worth ...
1
vote
0answers
349 views

Customizing the 3.5 “Add Media” popup (Backbone.js)

Here's yet another question in regard to the new(ish) 3.5 "Add Media" popup and how to customize it! What I'm trying to do I'm attempting to do four main things: 1) Create a custom tab titled ...
0
votes
1answer
80 views

Should I put my plugin javascript inline?

I have a small bit of (localised) Javascript bundled with a plugin. Currently it's in a non-minified .js file, called at via enqueue_scripts. Given that this script will likely run on every page, ...
0
votes
2answers
1k views

How to Add a .js file Only in one specific Page Dynamically to Head

I need to add some scrips for Google Maps only in my contact page and I do not want to populate it on all pages. I am not willing to create a custom header as well so I was thinking is there any way ...
1
vote
1answer
90 views

Enqueue Wordpress plugin scripts below all other JS

I am developing a simple Wordpress app but I am having an issue as all of the plugin scripts are rendered before those which are enqueued in my functions.php. Here is a sample section of the ...
0
votes
0answers
116 views

Pre-selecting category from drop-down list or convertingdrop down list to links

I'm using this plugin called buddypress links and in it's link directory page the user can sort through the links by category from a drop down list(screenshot).What I need is seperate links for each ...
1
vote
1answer
276 views

How to run a external JavaScript file on wp-admin if admin, and other if normal user?

I'm new to WordPress plugins, and I'm trying to load a external JS/jQuery file with some scripts I need. It needs to run in the wp-admin page (not just once when activated). There is a JS file for a ...
1
vote
1answer
133 views

Where to call wp_enqueue_script in a plugin with custom template?

I am writing my first plugin and I have this code in the main plugin php to replace home page with custom template add_filter( 'template_include', 'replace_home_page' ); function replace_home_page( ...
0
votes
1answer
23 views

how to request a script more than once in wordpress

Can I ask how I can request a script more than once in wordpress. For example: for($i = 0; $i < 2 ; $i++){ wp_enqueue_script('alerthello.js', 'example.com/example.js'); } I expect the code to ...
0
votes
0answers
228 views

Plugin - including external javascript calling google maps

I have developed a javascript plugin retrieving data for my website (no wordpress here). The user can simply add it to its website with a div (the container of the plugin) and a script tag (the ...
1
vote
1answer
158 views

Best approach to fetch data from wp options to js file or php file

I am creating my first ever plugin, as I am not a programmer, I have been following tutorials and reading the codex, etc. My plugin consist in showing a notice to users when certain conditions are ...
0
votes
0answers
69 views

get_option include <br /> in my adsense

As title said I saved in wp-options -> option_value a adsense code but when I try to display to website in the code I get some "<script type=\"text/javascript\"><!--<br ...
1
vote
2answers
837 views

How do I only load js on the post-new.php and post.php pages in admin?

I have some script that is loading in the admin. I only need it to load on the new post and edit posts screens. What is the best way to do this?
6
votes
1answer
110 views

API to trigger prompt on leaving page

I have a proprietary plugin that creates a metabox on the edit-post page. When the data managed by the plugin is edited and the user navigates away then we would like the user to be prompted as ...
1
vote
1answer
1k views

How to Load Plugin JS in theme's footer section

I am working on optimizing my theme so that the load time can be decreased, as of now i have used wp_enqueue_script() to add my custom js file and everything is working fine as expected. One thing ...
19
votes
1answer
3k views

Is it possible to reuse wp.media.editor Modal for dialogs other than media

To expand: I'd like to utilize the same Modal code/appearance ( as used in wp.media.Modal, wp.media.FocusManager ) to open a modal of my own custom dialog, not the Media Editor. In the past, I've ...
2
votes
3answers
958 views

How do I only load a plugin js on it's settings pages?

I have a plugin that is conflicting with some default wordpress functions. In the post and page creating/edit areas. I only need my functions on my settings pages. I have the js file loading in admin, ...
0
votes
1answer
51 views

Insert specific information to a posts of a predefined category

I want to show some detail information on specific (for e.g. category=3) posts. Therefore I use the following coding: function postinfo_head() { global $post; $script = <<< EOF ...
1
vote
0answers
669 views

How to bind data-src attribute for the image in the post using jquery?

I'm trying to use foresight.js for responsive image in the wordpress blog. For that I have to add the data-src attribute in the place of src in the <img> tag. Or I have to get the url from the ...
0
votes
2answers
641 views

How to Reload the Dashboard After Clicking Update in Quick-Edit?

How can I refresh the wp-admin/edit.php page after a user clicks Update in the Quick-edit form?
2
votes
2answers
532 views

Has anyone used require.js for handling plugin scripts?

I'm starting to refactor the code of my plugin and I'm thinking about using require.js to handle the scripts so that i have a codebase which is more modular and testable. And I'm also planning to load ...
0
votes
1answer
55 views

Is it possible to run javascript on plugin deactivated?

Is it possible to run javascript on plugin deactivated and if yes then, how should I achieve that. I have developing one plugin in which two new tables are created in wp database and on deactivation ...
-1
votes
1answer
3k views

how to include javascript file and css file in wordpress

I am creating new plugin so i need add a java script file and css file. These are my javascript files jquery.min.js jquery-1.3.2.min.js jquery.tabify.js Css file: newstyle.css
9
votes
5answers
6k views

Including jQuery and JavaScript files the correct way

I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and ...
5
votes
2answers
1k views

How to provide translations for a WordPress TinyMCE plugin?

I know that I can get my translations into JavaScript doing: $MyTranslations = array( 'translation1' => __("Some String 1", "MyTranslations"), 'translation2' => __("Some ...
3
votes
2answers
2k views

How-to implement admin Ajax inside an admin WP_List_Table?

I am new to WordPress if someone will help me I will be very appreciate. There is parameter ajax "true" but in docs. wasn't said how to implement Ajax using WP_List_Table Class? parent::__construct( ...
0
votes
1answer
39 views

On one of my sites a file is shown as 404 but the file IS there

(Cross-posted from stack overflow) I am building a WordPress plugin. The plugin works beautifully on one site. But on every other site I've tried so far one of the resource files used it getting a ...
1
vote
1answer
252 views

Mixing Regular Javascript With jQuery in a Plugin

Sorry for a simple question. I'm learning about plugins. I've got some javascript that I want to put in a jQuery file in my plugin. (I've got jQuery and the scripts enqueued, and working fine). ...
0
votes
1answer
73 views

should i be checking for jquery before enqueing it in a plugin

At the start of a typical plugin which uses jquery I have something like the following wp_deregister_script('jquery'); wp_register_script('jquery', ...
3
votes
2answers
627 views

jQuery in header or footer

From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for ...
0
votes
2answers
247 views

wordpress admin plugin menu custom css

I have a plugin that has a top level menu and subsequent submenus. Each one of these pages are going to need their own css and javascript. My code at the moment is: //main menu add_menu_page( "My ...
1
vote
1answer
4k views

How can I run AJAX on a button click event?

Update: I managed to get the AJAX working, but not in the click event. I updated the question to match this. I'm trying some code I found on the page: 'AJAX in Plugins'. However I can't get it to ...
2
votes
1answer
2k views

Hook the Keydown Event in the TinyMCE Post Editor

I would like to hook the keydown event in the TinyMCE Editor on the edit post admin page. I managed to hook the HTML content editor using the following code: jQuery('#content').keydown(function(){ ...
2
votes
3answers
496 views

wp_localize_script $handle

Can anyone tell me what the "$handle" ( first parameter ) of wp_localize_script is normally used for. Thanks. P.s.: I have no idea why but stackexchange is telling me this question dosen't meet ...
1
vote
1answer
152 views

Updating the Drag-To-Share eXtended share URLs?

How can I update the URLs that Drag-To-Share eXtended generates? At least in version 1.13, sharing items for Twitter and Facebook does not produce the proper url string for actually sharing the ...
0
votes
3answers
620 views

What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?

So the reason why I am don't want to include get_header() or get_footer() tags is because this page will be loaded as an iframe using the thickbox modal plugin and its content will be a form and I ...
0
votes
3answers
360 views

Plugin - Make sure jquery is loaded in my settings page plus my JS file

I'm creating my first wordpress plugin and I'm struggling to find the correct and best way to make sure jquery and my own JS file is included on my settings page of my plugin. I do not need them to ...
1
vote
4answers
10k views

How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?

I'm building a plugin and I want to add bits of javascript in the admin head but only for certain admin pages. I don't mean pages as in a WordPress page that you create yourself but rather existing ...
1
vote
2answers
1k views

How to trap “Publish” button to check for meta box validation?

I'm trying to do some form validation on my custom meta box, and I remember somewhere reading about some javascript function to disable/enable the Publish button - except I can't find it. How do I ...
1
vote
1answer
258 views

Inserting code to HTML view from a pop up initiated from visual view

I am trying to insert html into the HTML view.What i have done is to have tinymce advanced(a wordpress plugin) button that throws a popup and in it is all the necessary things to insert the html.The ...
5
votes
2answers
900 views

Test to see if jQuery or Prototype is queued by another plugin?

In my plugin, I want to test to see if jQuery or Prototype (or both) are going to be loaded by another plugin. So, have wp_enqueue_script('jquery') or wp_enqueue_script('prototype') has already been ...