Tag Info

Hot answers tagged

3

You don't have to specifically enqueue jQuery, as you're probably using jQuery in your custom script. You can do: wp_enqueue_script( 'my-script', plugin_url( 'js/my-script.js', __FILE__ ), array('jquery') ); jQuery(document).ready(function($){ //Do anything... }); Notice the $ passed as an arg to the callback, it will make jQuery accessible to your ...


2

You're on the right path with a rewrite rule. If you're just delivering a file, you can hook an early action, check if a download was requested, then output the file and exit before WordPress ever gets to the stage of querying the database and deciding the request is a 404. // add the download ID query var which we'll set in the rewrite rule function ...


2

You can try the following example, for image attachments: add_action( 'init', function() { add_rewrite_endpoint( 'download', EP_ROOT ); add_action( 'template_redirect', function() { if ( $pid = get_query_var( 'download' ) ) { $found = false; ...


2

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin. 'Warning: Attempt to modify property of non-object' Try this to avoid the warnings (code for the plugin file itself): //remove update notice for forked plugins function ...


2

Bad news first: We can't fix your JS problem (at least as long as the errors come from the jQuery UI version shipped with core and not from your custom definitions). This is a WordPress core problem. When you look at the SVN trunk, especially the main (and only) PHP file in that folder, you will see that the plugin doesn't even ship with any script... at ...


1

And there is your issue — WordPress does need to understand URL. Otherwise it is indeed 404 because it doesn't correspond to anything WP “knows”. You need to create that understanding, for example by using Rewrite API. Also since your data is external and isn't really a part of WP context, you will probably need to override 404 decision as well in the end.


1

Try: $the_query = new WP_Query( array( 'post_type' => 'Testimonials' ) ); Looks like you probably just need to change that to : $the_query = new WP_Query( array( 'post_type' => 'testimonial' ) ); You need to use the name you created it with when looking at post_type


1

If you want the theme to be independent from the CPT's, place the CPT's as plugin(s). If the CPTs go with the theme, functions.php sounds like the perfect spot for them. If you add them as plugins, you should group them in one or more plugins depending on functionality, not on post type.


1

With the below, you are grabbing terms from the event_category taxonomy Note that you are always grabbing the same terms though. $terms = get_terms( 'event_category', array( 'orderby' => 'count', 'hide_empty' => true ) ); If you want to grab only from the current pages children, then you should grab the current term ...



Only top voted, non community-wiki answers of a minimum length are eligible