Tag Info

New answers tagged

0

Two fairly simple ways I can think of: Use the output of your function my_load_ajax_content to draw <div id="project-container"></div> when you first render the page When the page loads, trigger your click button. $(window).on('load', function(){ $('.post-link').first().trigger('click'); }); As long is jQuery is loaded and you are ...


0

You might want to take a look at CRED plugin and see if it gets you anywhere near what you need. I've worked with it back when it was three different plugins (Types, Views and Access). For as much as I can remember they used to keep a testing environment where you could take plugins for a spin in a clean site on their server before you bought it, you ...


0

Maybe this plugin comes close to what you want? https://wordpress.org/plugins/adminer/screenshots/ However, you can use something like Sequel Pro to connect to the database to build SQL queries.


0

Here is my view: Load it inside your single.php why use ajax at all? Google wont be able to see this (using must crawlers). In any case - here is the right way to return the data... please note that you can use get_post or wp_query. up tp you. JS Part: jQuery(document).ready(function($) { $.post(ajax_object.ajaxurl, { action: ...


2

I think the solution is amazingly simple here: You're just missing a single line of code in your ajax callback, namely: global $post; where I assume you're using: $post = get_post( $post_id ); The reason is that there's a global post check in the WP_Embed::shortcode() method. More details in my answer here.


0

I think that a good way to get what you are trying to do is to use comment__not_in argument of get_comments() function. Send the IDs of the comments currently being displayed in the Ajax request and use them in the comment__not_in argument. For example, you could send those IDs as comment__not_in[] query var (array format): $comment_not_in = ...


1

Before anything else: Be really sure that your endpoint to retrieve this information is reasonably secure. (e.g. using SSL and some authentication like a password) Leaking the information which plugins are installed on a site might offer a point of attack for hackers. I am not going to offer you a ready-made solution but outline two different ...


-3

use Nextgen Gallery plugin to enable image management at its best. You can create album, galleries, set watermarks and more. With this you can create image galleries with the template option given within.


1

Add data-post_id attribute to checkbox and fill it with corresponding post ID. On click on compare button (link) retrieve all post ids from checked checkboxes with JavaScript (jQuery) Redirect to the comparision page with post IDs in url as GET parameters. This is just one scenario how you task could be done. PS your question is not related to WordPress ...


0

Use WordPress Ajax API for any kind of ajax related stuff. For more details : http://codex.wordpress.org/AJAX_in_Plugins


0

I'd say that depends mainly on the complexity of the posts you load. If they are as simple as... <div class="post-container"> <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> <?php the_content(); ?> </div><!-- .post-container --> ...I'd just put that in the AJAX handler and be done with ...


0

You have been answered in stackoverflow in the following way: <div id="tab-one" style="display: none">Tab1 info 1 content</div> <div id="tab-two" style="display: none">Tab1 info 2 content</div> <div id="tab-three" style="display: none">Tab1 info 3 content</div> <ul class="side bar tabs"> <li ...


0

I think there's some weirdness with [embed] shortcodes where you have to run them through WP_Embed::run_shortcode(), eg if ( strpos( $my_content, '[embed]' ) !== false ) { global $wp_embed; $my_content = $wp_embed->run_shortcode( $my_content ); } $my_content = do_shortcode( $my_content ); Update: however as no providers are ...


-1

try to use get_the_content(), like: $my_content = get_the_content(); $my_content = apply_filters('the_content', $my_content);


1

Maybe you have an image that was smaller or equal to the thumbnail size, if so, then no thumbnail will be created, and this.data[i].sizes.thumbnail will be undefined.


1

WordPress is heavy out-of-the-box. If you only need the database, you'd be so much better off using mysqli or PDO and just connecting directly. Not to mention (in my opinion) PDO beats hell out of wpdb anyway, win win. the idea is to make use of the DB defines in wp-config.php without needing to store the username/password somewhere else Create ...


0

FWIW... It APPEARS to have been a misconfiguration in the PHP.INI on a new Development Server (WAMP), which resulted in an unknown corruption of the code upon updating from wp4.0 to 4.1 such that PHP was injecting unwanted white space e.g. "\r\n\r\n..." in my AJAX responses (like a missing closing php ?> tag or someting?) When running ob_clean() before ...


1

your callback function must be like this: function cienna_show_slider_callback() { global $post, $product, $woocommerce; // just in case if your template file need this ob_start(); ?> <?php woocommerce_get_template( 'archive-product.php'); ?> <?php $output = ob_get_contents(); ob_end_clean(); echo $output; die(); }


0

The reason you cannot use this by default is because of no conflict. From the Codex: The jQuery library included with WordPress is set to the noConflict() mode (see wp-includes/js/jquery/jquery.js). This is to prevent compatibility problems with other JavaScript libraries that WordPress can link. In the noConflict() mode, the global $ shortcut for ...


2

I have been investing some quality time (and headaches) with WP ajax so I understand where you are coming from. In all honesty, it could be anything from an error in your JS code or something completely bizarre, like: add_action('wp_ajax_UpdateMeta', 'UpdateMeta'); Should be changed to: add_action('wp_ajax_updatemeta', 'UpdateMeta'); ... to remove ...


1

You have to use the admin-ajax handler to do the AJAX call. Replace file.php in var url = "file.php"; with yoursite.com/wp-admin/admin-ajax.php?action=simple_ajax And in your plugin / functions.php file, add add_action('wp_ajax_nopriv_simple_ajax','process_simple_ajax' //for non logged in user add_action('wp_ajax_simple_ajax','process_simple_ajax' //for ...


0

The line bellow probably does not read your action correctly that is why it returns 0 url: '<?php echo admin_url( 'admin-ajax.php' ); ?>', data: params + "&action=sendmail", Consider making an AJAX request similar to this: // the value of 'action' is the key that will be identified by the 'wp_ajax_' hook var data = { 'action': 'my_action', ...


1

The difference between the code you linked and your version, is that your post link has the permalink as the href value, where the original has just a hash. When you add a click handler to an anchor tag, it doesn't prevent what normally occurs when you click that link, it just executes the javascript and normal link behavior continues as it otherwise would. ...


0

The Codex includes a useful page on AJAX in plugins which outlines how to send and receive an ajax request. The code below covers how you would trigger an event when the select field is changed and fire off the ajax request. Make sure you're getting and setting a nonce value. /** * Only execute after jQuery is loaded */ jQuery(document).ready(function ($) ...


1

There isn't much point to distinguishing admin-ajax.php since it's essentially same file with same logic running for many many purposes. You are passing action data and hooking into respective action. So action is your identifier. If you are reusing same action and need to further differentiate — just pass more data with your GET/POST request and check for ...


1

Updating the url via javascript, is not related to WordPress, however you just need to modify window.location.hash in your jQuery code. Regarding the usage of admin-ajax.php it is recommended way to do tasks via AJAX that need to load WordPress environment, instead of manually requiring wp-load.php. In your case you are sending a request to a regular ...


0

To Ajaxify the request you need two parts, a php function, hooked to the wp_admin_ajax ( and the wp_admin_ajax_nopriv if you want it to be available for non logged in user) and a JavaScript to request the AJAX. PHP add_action('wp_ajax_getpost_by_year','process_getpost_by_year'); add_action('wp_ajax_nopriv_getpost_by_year','process_getpost_by_year'); ...


0

Shouldn't you add full path of the ajax.php in your code. If your ajax.php file is in theme folder then you can use get_template_directory_uri() function to define file path. So this should be your code. $(document).ready(function () { var ac_config = { source: "<?php echo get_template_directory_uri(); ?>/ajax.php", select: ...


0

I found a solution without ajax. I just put all the data to a json-file and used a jquery-client-solution as described here: http://css-tricks.com/dynamic-dropdowns/ .



Top 50 recent answers are included