How do I Make a custom post type get a custom post template in a plugin

function get_custom_post_type_template($single_template) { global $post; if ($post->post_type == ‘events’) { $single_template = dirname( __FILE__ ) . ‘/single-event.php’; } return $single_template; } add_filter( ‘single_template’, ‘get_custom_post_type_template’ ); Source Or you could use: add_filter( ‘template_include’, ‘single_event_template’, 99 ); function single_event_template( $template ) { if ( is_singular(‘event’) ) { $new_template = locate_template( array( ‘single-event.php’ ) ); if ( ” … Read more

Custom theme sufficient or custom plugin neccessary for this feature set?

WordPress will not automatically provide these features. From what you are describing, you will want to create custom post types, a taxonomy or two for classification and custom fields for the post types. You COULD build all of this into a WordPress theme but the generally advised approach is to wrap your functionality into one … Read more

In a plugin, why is add_action(‘init’) not executed before the plugin is activated?

WordPress is an application and everything that is run within that application is called by hooks. Then 2 main hook functions are add_action and add_filter, but as you saw, register_activation_hook and register_deactivation_hook are other functions that are used in the context of activation and deactivation. There exist more hook defining functions, like functions that will … Read more

How can the tinyMCE dom be manipulated (offical API does not seem to work)?

Hope You can use fallowing // Sets class attribute on all paragraphs in the active editor tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select(‘p’), ‘class’, ‘myclass’); // Sets class attribute on a specific element in the current page tinymce.dom.setAttrib(‘mydiv’, ‘class’, ‘myclass’); or You can add Id by jquery like this $(‘div’).find(‘p’).attr(‘id’, ‘myid’);