A snippet after every image

Try get_image_tag filter: add_filter(‘get_image_tag’, function($html, $id, $alt, $title, $align, $size) { return $html . ‘<div>some piece of code here</div>’; }, 10, 6); References: get_image_tag() get_image_send_to_editor() wp_ajax_send_attachment_to_editor()

How do I call wp_mail from HTML?

First the way to do this is with a form using the post method, it is slightly easier to understand: <!– form with AJAX action and iframe target –> <form method=”post” action=”<?php echo admin_url(‘admin-ajax.php’); ?>” target=”emailsendframe”> <!– AJAX action field to trigger function–> <input type=”hidden” name=”action” value=”download_email_send”> <!– Post ID field –> <input type=”hidden” name=”intro” … Read more

How to: add option to add more checkboxes on custom post type

Your question is very abstract. As far I understood you want some thing like categories. So for that adding metaboxes is not necessary. I think categories are enough. If categories are not full filling your need then make another custom taxonomy with ‘hierarchical’ => true,. I think it will serve your need. Also giving permissions … Read more

Dequeue script in template isn’t working

Move your project_dequeue_unnecessary_scripts() function to your functions.php file and add a conditional statement to determine if the appropriate template is being loaded. E.g.: // Remove Mobile Header function project_dequeue_unnecessary_scripts() { if ( is_page_template( ‘name-of-template.php’ ) ) { wp_dequeue_script( ‘enterprise-responsive-menu’ ); wp_deregister_script( ‘enterprise-responsive-menu’ ); } } add_action( ‘wp_print_scripts’, ‘project_dequeue_unnecessary_scripts’ ); I suspect that your function is … Read more

Hide WYSIWYG editor on certain templates

I hope I understood your question right. The following code will remove the editor from the pages using particular templates: <?php function wpse242371_remove_editor_from_some_pages() { global $post; if( ! is_a($post, ‘WP_Post’) ) { return; } /* basename is used for templates that are in the subdirectory of the theme */ $current_page_template_slug = basename( get_page_template_slug($post_id) ); /* … Read more

Append taxonomy terms as class names in markup?

Differ the output until you have a collection ready. $terms = get_the_terms( $post->ID, ‘teams’ ); // create a collection with your default item $classes = array(‘person’); foreach ($terms as $term) { // add items $classes[] = $term->slug; } // output all the classes together with a space to separate them. echo ‘<div class=”‘ . implode(‘ … Read more

Create an array from an array

You can split your array using the following $array = array(1,2,3,4,5,6); $number_of_elements = 3; $count = count( $array ); $split = array(); for ( $i = 0; $i <= $count – 1; $i++ ) { $slices = array_slice( $array, $i , $number_of_elements); if ( count( $slices ) != $number_of_elements ) break; $split[] = $slices; } … Read more

Functions.php reverted to new one

You should not change anything in files inside wp-admin and wp-includes folder. All these files gets overwritten when WordPress is updated. The correct functions.php file is in your theme folder. full path to that file: wp-content/themes/YOUR-THEME-FOLDER/functions.php