Query Custom Post Types & category_name?
Just figured it out. The post type had a custom taxonomy so had to replace category_name with slides_categories
Just figured it out. The post type had a custom taxonomy so had to replace category_name with slides_categories
It sounds like you are asking for two features here: Image annotation Image comments You referenced a plugin for the first, and WordPress supports the second out of the box! As another choice, in the last link you provided, that person is using Flickr to handle their annotations and comments. This is another great option … Read more
Yes, AJAX is the way to go. Basically, you can write your own callback function for WP’s ajax hook in your theme’s functions.php file. And then your function can return data in any format you choose. I generally return JSON. I’ll walk you through setting it up. First, since it doesn’t appear that your visitors … Read more
As @MatthewBoynes already stated, making a $.post() request for every image might bring some overhead. A maybe better solution would be to grab and cache them, then throw them into your js files using wp_localize_script(). $attachments = get_posts( array( ‘post_parent’ => get_the_ID() ,’post_type’ => ‘attachment’ ,’posts_per_page’ => -1 #,’exclude’ => get_post_thumbnail_ID() // only needed if … Read more
Pretty sure it’s because the official jQuery CDN doesn’t support HTTPS – use Microsoft’s or Google’s instead.
As other have mentioned , there is no great answer to this, ultimately you cannot control how other people write plugins/themes and there are no standards for naming wp_enqueue_script‘s, though there probably should be. Also there is no current way to check if jQuery is loaded using wp_enqueue_script, though this is very easy to do … Read more
Create a /js subfolder in your theme directory, if such does not exist already. Save your script to a file in said folder. Then, in functions.php: if ( is_admin() ) { global $pagenow; if ( ‘customize.php’ === $pagenow ) { add_action( ‘admin_enqueue_scripts’, ‘wpse107236_enqueue_customizer_script’ ); } } function wpse107236_enqueue_customizer_script() { wp_enqueue_script( ‘your-script-handle’, get_template_directory_uri . ‘/js/your-script.js’, array( … Read more
If this is in a widget class, you need… add_action(‘wp_ajax_my_func’, array($this,’my_func’)); … not just… add_action(‘wp_ajax_my_func’, ‘my_func’); However, I suspect there to be more problems than just that due to the context you are using this in. But without more code, that is all I’ve got. Based on new information in the question… Both your function … Read more
Assuming your javascript and ajax action code are otherwise correct, target admin-ajax.php with the correct path by localizing your enqueued script: wp_localize_script( ‘your_script_handle’, ‘script_data’, array( ‘admin_ajax’ => admin_url( ‘admin-ajax.php’ ) ) ); Then in your javascript, reference that URL with: url: script_data.admin_ajax EDIT- ah, missed this the first time: $wpdb->feedmanager isn’t set unless you’ve explicitly … Read more
You can hook into the DOMNodeInserted event to find out when your widget has been added to the side bar. jQuery(document).on(‘DOMNodeInserted’, ‘.widget-top’, function () { alert(jQuery(‘.widget-title’, this).text()); }); The code above will alert to any newly added widget. Once you’re hooked into the newly created widget, you can traverse it to find your specific class … Read more