A client side scripting language useful for making interactive web sites

learn more… | top users | synonyms

0
votes
3answers
1k views

theme path in javascript file

I need to include the path to my theme file within a javascript file. How would I go about this? I have already tried: var templateUrl = "<?php get_stylesheet_directory_uri(); ?>"; function ...
0
votes
1answer
84 views

I keep getting Javascript error messages

I think something in my code must be utterly wrong because as soon as I manage to fix one error that I found, the next one pops up. I just managed to solve this problem. Now this error message keeps ...
-1
votes
1answer
57 views

new to javascript - using in <head> instead of functions.php, not loading correctly

Live site. I've decided to incorporate javascript in my new theme; this is my first time doing so and have pieced together what I've down with help of blog posts and forums. I have the javascript ...
0
votes
2answers
198 views

jQuery UI inside widget on admin page

I have created a widget that has quite a few settings, and so I am trying to create a tabbed menu (using jQuery UI) inside the widget settings of the admin page. The problem is basically that tabs ...
0
votes
1answer
139 views

Javascript in wordpress

I have featured images shown for different posts of same category in a page in a specific div. I need to show the whole post related to this image in the same page in another div. I know i must use ...
1
vote
1answer
865 views

What is the Javascript event for an item being added to the cart in Woocommerce?

I can't seem to find this in the docs or through google. So basically I'm just looking for the Javascript event that fires when an item is added to the cart. For some reason my default added to cart ...
3
votes
1answer
493 views

How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?

How would I go about combining multiple CSS files and concatenating my scripts if they're being enqueued as WordPress recommends? My site is pretty slow and would like to optimize for performance.
0
votes
2answers
43 views

Including Javascript options

For a Wordpress Theme I know javascript files (ending in .js) must be included using wp_enqueue_script in functions.php but how do I include additional javascript code, for example say I need to add ...
0
votes
1answer
123 views

Paginated WP_Query doesn't return 404's, even when posts don't exist

I'm currently building a theme for a client, and one of their requirements is endless scrolling on a "Charts" page. They want this to be paginated, and the endless scroll to load the next page below ...
1
vote
1answer
278 views

How do I get my page to load the jQuery UI Effects library?

I'm using javascript for the first time to do some simple animations on the home page of my website. So far I have added the following to my header.php file (which is only used for my home page), ...
0
votes
2answers
209 views

My jQuery is enqueued properly. So why isn't it working?

I'm just trying to add a simple bit of Show/Hide jQuery to a child theme. $(document).ready(function(){ $("#openbtn").click(function(){ $("#openingtimes").toggle(300); }); }); I've saved the ...
19
votes
1answer
1k 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 ...
0
votes
1answer
170 views

How to add additional JavaScript code [duplicate]

I'm developing a mobile site and the template I'm using is based off of Jquery Mobile. In the header.php file, the template I am using is making calls to CDN javascript files: <link ...
0
votes
1answer
721 views

Add multiple JavaScript files to template header [duplicate]

I have multiple JavaScript files that I want to load. Some of them in my header.php and the rest in the footer.php. These are the files: <?php <script type="text/javascript ...
1
vote
1answer
479 views

prettyPhoto media loading very slowly in Chrome

I'm having a problem with prettyPhoto media WordPress plugin (lightbox type) script in Chrome. It works beautifully in other browsers, but it takes forever to load in Chrome. When using this script ...
0
votes
1answer
60 views

Can't insert files in other inputs

I'm trying to allow multiple images to be uploaded to the media library where I can then take the URL of the image and insert it into a custom page on the website but for some reason, when I click on ...
0
votes
2answers
161 views

Is the wp_enqueue method efficient?

I had a quick question regarding how you are supposed to load in scripts with Wordpress. I am developing a theme and I know that the best way to do this is to use the ...
0
votes
2answers
165 views

custom page url slug needs illegal ?id=1 for javascript

I have created portfolio page which contains a image-slid-menu for navigation. For an menu item to appear as open, javascript gets instruction like ?id=0 appended to the url. for instance ...
0
votes
2answers
3k views

Add captcha validation to my custom form for Frontend posting

i have implemented the frontend form, which enables UNREGISTERED users to post on my site. Everything in working perfectly, the only problem I have is with the implementation of the captcha. All of ...
0
votes
2answers
832 views

How to modify the paths of js from twentytwelve theme?

<?php wp_head(); ?> from my default wp theme generates <script type='text/javascript' src='http://example.com/wp-includes/js/comment-reply.min.js?ver=3.5.1'></script> <script ...
2
votes
0answers
107 views

Continue javascript execution when errors occurs [duplicate]

I use the WP native function wp_enqueue_script() for all my JavaScripts loading both in WP front and back-end so it can handle duplicated calls to the same script and so on. One of the issues is that ...
0
votes
1answer
169 views

How to enqueue script based on post category?

I have scripts for various little tools I have made using some js and html. I want the js to load only on specific single posts in side a specific category. I have tried the following code and it does ...
2
votes
1answer
65 views

Handling URLs in WordPress application

We have a web application that we run inside of WordPress in order take advantage of WordPress's authentication. To make this work, we created a template type for our application that simply includes ...
2
votes
1answer
146 views

Archive dropdown styling not applied

I am trying to add a custom dropdown for archives but struggling with couple of mistakes that might be the reason why it doesn’t work. The CSS only gives my dropdown the width, not the other styles ...
2
votes
1answer
107 views

javascript is not working on Event Submission?

I am using Events Manager Plugin Javascript is not working on Submit Events Page . I found the reason behind this , that was, I have written a line of code in functions.php to call jquery file. ...
0
votes
1answer
73 views

Wordpress video end function [duplicate]

Possible Duplicate: $ not defined using jQuery in Wordpress I need to trigger a alert box when video ends THis is the code i got from google <script> ...
1
vote
1answer
101 views

Does WordPress Development Mode Exist (with not minified JS)?

A lot of WP JS is minified and therefore it's hard to be analyzed in the Console. Is there any way to have all scripts uncompressed?
2
votes
1answer
184 views

WP3.5 Media Uploader - how to make it accept multiple images?

I'm wondering how to make WP3.5 media uploader return 2 or more items in attachement? It always runs once even if 2 items are selected. The code: $('.button').on('click', function(){ var ...
2
votes
1answer
116 views

How to include admin-ajax when loading external javascript

I'm creating a plugin that has some external Javascript and some AJAX calls ... but I don't know the best way to make reference to the admin-ajax.php file since the path requires some input from PHP ...
2
votes
1answer
337 views

How do I enqueue(or delay loading of) <script> tags in individual page posts?

My customer has many pages with <script> elements including javascript. <script src="myscriptforthispageonly.js"></script> I'm trying to get all scripts to load in the footer ...
0
votes
2answers
316 views

Including javascript for a shortcode

I'm creating a plugin that allows a user to use a shortcode. This shortcode depends on a bunch of javascript that needs to be present once the shortcode loads. I'm having issues trying to decide when ...
1
vote
1answer
119 views

Get post meta in enqueued js file

I am writing a plugin in which I have a js file. I enqueue it with wp_enqueue_script. In this file I have some functions. The functions are triggered by an onclick event of a button. The button is ...
2
votes
3answers
564 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, ...
3
votes
2answers
3k views

Defer Parsing of Scripts

this is my first time to try this "Defer Parsing" thing, and I don't really have an idea how to do it. Using PageSpeed tool, I found out that one of the reason why my page is loading too slow ...
0
votes
2answers
71 views

Proper Javascript Implementation

Instead of calling a script from a file, I put a number of my javascripts in a template file called codes.php. I then call codes.php in the footer by pasting <?php include (TEMPLATEPATH . ...
0
votes
1answer
49 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
2answers
2k views

Repeatable custom meta fields

I am working on creating custom meta boxes for the back-end of WordPress. I would like to add a metabox with several fields, in my case an image upload and a text input, but with a button that can ...
0
votes
1answer
321 views

How to make featured image thumbnails on index page load smoother?

I'm using a theme called Hatch Pro, which is a gallery based theme and the index page displays the posts using the featured image. You can see it here. On slower browser environments, the images ...
12
votes
2answers
648 views

Trigger refresh for new media manager in 3.5

I'm trying to figure out how it's possible to 'refresh' the media library in the new media dialogue in 3.5. I'm adding images from an external image library to the WordPress library (via a tab/iFrame ...
0
votes
1answer
245 views

How to add a onclick attribute to a list of checkboxes?

I have this array for checkbox: array( 'name' => __('Latest Product',''), 'desc' => __('Select if you want to display latest product',''), 'id' => $prefix . ...
0
votes
1answer
143 views

Admin can enter JavaScript - potential security risk?

WP 3.5/TwentyTwelve/Clean install. I try this when login as admin and editor. I try add reply for first post "Hello World": <script>alert('XSS')</script><script><</script> ...
1
vote
1answer
498 views

Multisite configuration fails with css/js files

I have installed Wordpress using multisite + path (as opposed to subdomain). Seems to work, except JS/CSS files are not loaded. my conf: <Directory "/var/www/pages"> Options All ...
4
votes
2answers
275 views

Want image captions to be from img ALT tags not title tags

Okay,here's my challenge. My client doesn't like how when you roll over an image in the gallery a tooltip shows up with the image's descritpion, which is taken from it's title tag. But he still wants ...
1
vote
1answer
522 views

How to add code to just before closing body tag

How would I put the following code, for a certain shopping cart, just before the closing body tag in my WordPress site? In the footer? It seems to me that I would only want to call startcart() for ...
0
votes
2answers
157 views

how do i in ignore/disable/delete a javascript call from parent in child theme?

I am working on a child theme and I want to disable a JavaScript file from the parent folder instead of deleting it. I have a functions.php file in my child theme folder but don't know how to do it. ...
0
votes
1answer
85 views

Javascript will not run properly

I have this code which runs perfectly on jsFiddle. When I try to run that code on my self-hosted WordPress site, however, it will not run. (The code is exactly the same on my page, except that I added ...
0
votes
2answers
267 views

How can I only show one responsive menu on mobile devices?

Here's my site: http://dev.shoeporn.com/ I'm running WP 3.5 and using this plugin: http://wordpress.org/support/plugin/responsive-select-menu It is supposed to allow you to select which menus you ...
0
votes
1answer
521 views

Ajax URLs without #!, how to prevent falling into single.php on load or reload?

I'm trying to make things properly with a single page ajax powered portfolio. I've read that there is no need of #! to make it crawlable by google. So I have clean URLs that updates with .pushState ...
0
votes
1answer
238 views

Dropdown menu on click change

Im working on a website where I need to create a submenu that shows only the parent pages. When I click on one of the parents it has to show the children from that parent. Here is the menu hierarchy ...
0
votes
2answers
286 views

custom css and javascript not working on page defined as template?

I have written a web-page which is a web-app (a simple card database using php, mysql, and styled with css3). The page works as expected. A friend of mine proposed me to use wordpress for everything ...