# Tag Info

## New answers tagged javascript

1

The CSS is in wp-admin/css/colors-classic.css and wp-admin/css/colors-fresh.css and the min versions of those, including the icons32-2x.png ones. I can see them when I grep the directory. For example, wp-admin/css/colors-classic.css:2162. The images themselves are in wp-admin/images, as you can see from the style rules, but you should not be ...

1

Use wp_localize_script function set_js_var() { $translation_array = array( 'blog_name' => get_bloginfo('name') ); wp_localize_script( 'jquery', 'my_data',$translation_array ); } add_action('wp_enqueue_scripts','set_js_var'); If you look at the source of the page you will see something like: <script type='text/javascript'> /* <![CDATA[ */ ...

0

I assume your problem was AJAX was working if your are logged in and it was not working in logged out status, right? There is a function in WordPress to access AJAX-based files for non logged users: wp_ajax_nopriv, for example /* works for logged users */ add_action( 'wp_ajax_my_action', 'my_action_callback'); /* works for non logged users */ add_action( ...

2

You can store the data in the user meta as an array of post-id -> comment count at last visit and then simply count the comments since that date, for example function get_user_comment_count_since_last_visit($user_id ,$post_id){ //only do this for logged in users if ($user_id <= 0 ){ return 0; } /** * get last comment count ... 0 If the files show up in the html source then there is something wrong with your javascript (it may even be as simple as missing a semicolon in the wrong place). Without further information we can't help you. Beware that wordpress loads jquery in no conflict mode so the function call is jQuery() and not$().

1

I'm not sure this is a real answer, but have you tried PHP-markdown-extra (by the very same Michel Fortin)? At least for me (using Mark Jaquith's markdown-on-save plugin) your example is not a problem. But Markdown-extra is not perfect either and I've seen some other quirks with respect to emphasis, e.g. Let $(y_n)_{n\in \omega}$ enumerate ${ x_i: i \in ... 1 Dominik Schilling - the author of the WP 3.5 media manager - has written a set of demos for media modals. You can view them on GitHub. 3 As a corollary to @s_ha_dum's answer, you could also register scripts with hierarchically declared dependencies, and then just enqueue your ultimate script. Something like so: function add_my_script() { // Register first script, dependent on jQuery wp_register_script( 'imagesLoaded', get_template_directory_uri() . ... 6 I formatted that code as best I could, and once formatted it is obviously very broken. wp_enqueue_script takes 5 parameters. You have 9. And several of the first five are wrong. I expect that you would see errors if you had debugging enabled. You seem to be trying to enqueue all of your scripts in the same wp_enqueue_script. You can't do that. Perhaps that ... 0 Besides WP Minify, I would recommend you to use the Selective Loading Plugin. It'll help you load only the plugins you want to load based on pages/posts and categories and it will improve your WP's loading time. 0 Did you check your hosting environment to see if they've enabled something like mod_pagespeed? https://developers.google.com/speed/pagespeed/mod 0 Are you using different versions of WordPress in the 2 locations? Are there any other plugins that are different? Perhaps the PHP setups are different between local and online. There's lots of things that could be different other than the code. Personally I would recommend the Jetpack plugin (http://jetpack.me/) and it's contact form extension. I like that ... 0 Just found out that reCaptcha actually rejects CAPTCHAs which are submitted to their server more than once. Since I was using the WP-reCAPTCHA plugin, the plugin resubmitted the CAPTCHA after my AJAX submission. So I just commented out a line from the plugin that does the submission, which is in file recaptcha.php, line 27:$this->register_filters();

1

For those who debug "not working" datepicker - for me it was an issue of my reset css, specifically of this: html, body { overflow: auto; } My datepicker was alright, but kept appearing on far top of the screen. :)

0

i found the solution i just added all scripts together

1

The best way to do this is to use wp_localize_script(), it serves exactly the purpose you are mentioning: passing strings to Javascript from PHP. You can do all sorts of interesting things with that: as a rule of thumb, use that when you want PHP to communicate with Javascript. In your case you want something like this: $ritc = array( 'initialize' => ... 1 This is in wp-admin/js/common.js or wp-admin/js/common.min.js: // Scroll into view when focused$('#contextual-help-link, #show-settings-link').on( 'focus.scroll-into-view', function(e){ if ( e.target.scrollIntoView ) e.target.scrollIntoView(false); }); Found with a search for show-settings-link in the complete source. :)

2

Check the page and enqueue your script accordingly: global $pagenow; if (! empty($pagenow) && ('post-new.php' === $pagenow || 'post.php' ===$pagenow )) add_action('admin_enqueue_scripts', 'enqueue_my_scripts'); function enqueue_my_scripts() { wp_enqueue_script(...); } // function enqueue_my_scripts

2

The global variable $hook_suffix is: post-new.php for the new post and post.php for the regular post editor In wp-admin/admin-header.php there are some special hooks: do_action('admin_enqueue_scripts',$hook_suffix); do_action("admin_print_styles-$hook_suffix"); do_action('admin_print_styles'); do_action("admin_print_scripts-$hook_suffix"); ...

0

Try this: function my_theme_prefix_load_javascript() { wp_register_script( 'jquery-defaultvalue.js', get_template_directory_uri() . '/javascript/jquery-defaultvalue.js', array('jquery'), '1.0', true ); wp_register_script( 'tytabs.jquery', get_template_directory_uri().'/javascript/tytabs.jquery.min.js', array('jquery'), '1.0', true ); ...

0

ok i added this code to function.php it didn't give me " server error " but i think there still something missing because jquery still not working add_action( 'wp_enqueue_scripts', 'wpcandy_load_javascript_files' ); wp_register_script( 'jquery', get_template_directory_uri() . '/javascript/jquery-1.8.2.min.js', array('jquery'), '1.8.2', true ); ...

0

It's not the Plugin that is at fault, but the Theme. The Theme enqueues a custom version of jQuery, which you should never ever do. Also when the jQuery plugin is initialized, you need to use noConflict wrappers like this: jQuery(document).ready(function($) { // Inside of this function,$() will work as an alias for jQuery() // and other libraries ...

1

Always Put wp_head() in header and wp_footer() in footer. the plugin uses this hook Header.php: <?php ... /* Always have wp_head() just before the closing </head> * tag of your theme, or you will break many plugins, which * generally use this hook to add elements to <head> such * as styles, scripts, ...

1

console.log() is a JavaScript function. You cannot use it in PHP. Add that to your JavaScripts. The version parameter should not affect the file access. But you can remove that parameter and see if it works then. If it does, your server configuration needs further inspection, because it should also work with the version.

Top 50 recent answers are included