Tag Info

New answers tagged

0

If you're looking to use this with Custom Posts, replace where it says post in the if statement with the slug of your post type. With Custom Taxonomies, replace where it says #category-all with the name of your taxonomy (e.g., #taxonomyname-all). Your situation will most likely be both if you are looking at this. For multiple taxonomies/post types at the ...


0

I would just put the custom fields in the <li> after the <a> and then show/hide them with your preferred tooltip method, whether it be CSS, JS or a combination of the two: <?php if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <li> <a href="<?php ...


0

It is not enough to enqueue jquery (or any other library) before your jquery dependent code, but you also need to make sure jquery is loaded before your code is being parsed/run by the browser.


0

function script_that_requires_jquery() { wp_register_script( 'script-with-dependency', 'http://www.example.com/script-with-dependency.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'script-with-dependency' ); } add_action( 'wp_enqueue_scripts', 'script_that_requires_jquery' ); This is the correct method to enqueue scripts (and styles ...


0

Your code: ul#menu-menu-1 > li,a:first { margin-left: 0px; } You need to apply the first-child to the list element, and not to the link. You should also not have a comma. Comma indicates a new selection. Try this: ul#menu-menu-1 > li:first-child a{ maegin-left:0px; } *first-child does not work in ie8 and earlier.


0

As already pointed out, this is a CSS-specific question. Here is one approach to do this, anyway: /* Reset left margin for ALL items */ ul.menu li { margin-left: 0; } /* Set it back for any item that's not the first one */ ul.menu li + li { margin-left: 10px; } Depending on your current CSS, you might have to change the selectors (e.g., use a ...


1

Something is messing up your queue. Your jQuery URL has 1.8.3 version, while that is neither default in WP 3.9.1 or actual file it points to (1.11.0). Migrate is not showing up for me either, likely because of issues there. Effectively you are missing jQuery.browser because it was removed in version 1.9+ and migrate is not loaded.


2

I have checked your site jQuery migrate is not enqueued as the version of jquery enqueued is 1.8.3 and jquery migrate only works with jquery version above 1.9 Probably your version of wordpress in not the latest one . The version of preetyphoto is outdated too you can use the latest version ...


3

You should remove these lines from your header.php <script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascripts/jquery.js"></script> <script language="javascript" type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascripts/tabber.js"></script> <script ...


1

Here is the correct way to include jQuery in your theme. Open functions.php in your theme folder and add this to it: // Proper way to enqueue scripts and styles function royal_insert_jquery(){ wp_enqueue_script('jquery', false, array(), false, false); } add_filter('wp_enqueue_scripts','royal_insert_jquery',1); This will load the ...


0

If a plugin is written well (or the theme) than you have no reason to worry about duplicate jquery loading. if your theme uses header.php to load jquery then your doing it wrong and should use enqueue scripts to load jQuery... Wordpress uses wp enqueue script to declare scripts once and not multiple times. Example of loading scripts the right way: ...


1

The simple answer is to never add script tags directly to template files. This is exactly why the WordPress script registration and enqueue system exists.


0

Not a direct answer to your specific case but this will probably help you figure out how to do it. I found an article here: http://www.sutanaryan.com/jquery-duplicate-fields-form-submit-with-php/ which details the process of posting fields which can be repeated using jQuery. In his example he creates an HTML form: <form action="process.php" ...


0

As long as there have been no changes to the live since since you took the backup of it to work on in your dev environment, then yes you can replace the existing database with yours. You do not need to activate the new theme on the live server - the currently active theme is stored in the database, which you will be overwriting with your database backup ...


0

Your first line works for me when I type it in the console of Chrome: jQuery('#post_status option[value="draft"]').text('Approve'); so I assume your problem may be that the element you want might not be loaded yet from where you run your script. Try wrapping it in this: jQuery(document).ready(function() { (function ($) { $('#post_status ...


0

AJAX/jQuery is not limited to any specific "area" like plugins or widgets, in fact some plugins consist solely of widgets (although afaik the converse cannot be said). This Smashing article might be a good primer. When you finish with that then check out Gary Cao's WordPress + AJAX tips and come back with a more specific question.


0

Yes you should use die(); in ajax function call, but because you're not returning data and don't care what is returned it's not necessary You should be using nonce, it's good practice to get used to always using it regardless of the situation. http://codex.wordpress.org/WordPress_Nonces http://codex.wordpress.org/AJAX_in_Plugins You should not be using a ...


0

when form (or other) data is submitted via AJAX, it can be accessed via the $_POST or $_GET variables depending on the method used. In your case, you are using the post method so you can access your 'lat' and 'lng' with $_POST['lat'] and $_POST['lng'] and manipulate them as needed.


1

Ok the problem i found in your above code is you have not mentioned the path of your library function em_bookings_events_table() { ........ ....... ....... wp_enqueue_script('name_of_script','place Path_of_your_jquery_file here'); } add_action( 'wp_enqueue_scripts', 'em_bookings_events_table' );


1

The proper way to include jquery in your plugin is /** * Proper way to enqueue scripts and styles */ function theme_name_scripts() { wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true ); } add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );


2

Just to chip in,first of all, thanks for the complement, appreciated. You are using a child theme, of which the parent theme should have enqueued the jquery library built into wordpress. Like I said in the post you are refering to, it is bad practice, my emphasis, for any parent theme to not enqueue jquery by default. You have a couple of problems with ...


0

As ungestaltbar said, the variable "data" should contain an object, not a string. function show_trend() { var data = { action: "render_admin_charts_page" } jQuery.ajax({ type: "POST", url: "../wp-admin/admin-ajax.php", data: data, dataType: 'json', ...


2

Wordpress has essentially two groups of methods to handle scripts, both of which should be used: wp_register_script Registers a script in Wordpress. It does not get called, it is just available for Wordpress, if it is needed. wp_deregister_script is the exact opposite. It deletes the definitions made in wp_register_script, the script is no longer ...


1

basically you want to declare this function in another file add_action( 'wp_ajax_render_admin_charts_page', 'yourfunction' ); ? if yes then you can place this piece of code in function.php in from your active theme add_action( 'wp_ajax_render_admin_charts_page', 'yourfunction' ); function yourfunction() { ?> <div class="wrap"> ...


1

To add action for wordpress ajax If you needed to create an AJAX handler for an "render_admin_charts_page" request, you would create a hook like this: add_action( 'wp_ajax_render_admin_charts_page', 'yourfunction' ); function yourfunction() { ?> <div class="wrap"> <div class="em-bookings-events"> ...


0

If you visit your website and view the page source, look for that file you are trying to include, if you cant find it, then you know you have not loaded it correctly. If you can find it, check the path is correct. This way you make 100% sure it is being referenced and is accessible for your site to use where its needed and you can start trouble shooting ...


0

.animate() is the jQuery function you're going to want to have a look at. Very handy. Here's a working example for your particular question: http://jsfiddle.net/B8Yv9/ And a complete html workup: <!doctype html> <html> <head> <meta charset="utf-8"> <script type='text/javascript' ...


1

Your question is a bit broad. We actually have a one question per post policy. I'm going to try to answer though My first question is, shouldn't most themes that you download out there automatically include jQuery in your header anyway? Well, basically correct. So many features today in a theme needs jquery to run properly. I haven't came across a ...


1

Your $scr in your wp_register_script() function is wrong. Given that your functions.php is inside your plugin, and your removeArrows.js is in the root of your plugin, your $scr should look like this plugins_url( '/removeArrows.js' , __FILE__ ) Another point of note, it is always good practice to load your scripts and styles last. This will ensure that it ...


0

Sometimes the best recommendation is to abandon an idea. And this is my recommendation: Do not try to push Interface elements from interface A into interface B. Imagine that you bought yourself a Porsche. And then imagine you get into your new car, which comes with a set of expectations that you have, and suddenly you are looking at the dashboard of a ...


0

I would not add another external js file, its just an extra and unnecessary resource to fetch and that is something we want to cut down on in terms of page loading times. I would add this jQuery snippet in your websites head using the wp_head hook. You would paste the following in your theme or plugins functions file. I have also made sure jQuery is in ...


0

You could fill in the form as shown below: inputs = document.getElementsByTagName('input'); for (index = 0; index < inputs.length; ++index) { // assign inputs[index] element values from the response. } This is pure JavaScript, unless I miss something.


0

To ajax this function you have hook it, so your function will be like this : function write_cat_list($cat){ $cats = get_categories('hide_empty=0'); if($cats) : $tinyMCE_list = array(); foreach ($cats as $cat) : $tinyMCE_list[] = array( 'text' => $cat->name , 'value' => $cat->term_id ); ...



Top 50 recent answers are included