Animated Accordion [closed]

Since you already loading JQuery, add the following $(‘document’): (function($) { $(window).load(function() { //lets wait for all to be loaded alert(“Accordion script loaded”); var acc = document.getElementsByClassName(“accordion”); var i; for (i = 0; i < acc.length; i++) { acc[i].onclick = function() { this.classList.toggle(“active”); var panel = this.nextElementSibling; if (panel.style.maxHeight){ panel.style.maxHeight = null; } else { …

Read more

Show one post per author and order by custom field

You use a AND statement after a GROUP BY statement. That wont work. Try altering the WHERE statement (posts_where_paged filter) to add the AND pm.meta_key = ‘KEY’ line. Additionally you can use the posts_orderby filter to alter the ORDER BY. EDIT You can find some additional information here.

Load script only on selected Pages

You can use conditional tag such as is_page(). Register your script on hook wp_enqueue_scripts and enqueue it in if statement : wp_register_script(‘myashdrop’, get_template_directory_uri() . ‘/js/dropdown.jquery.min.js’, array(‘jquery’)); if (is_page(PAGEID)) { wp_enqueue_script(‘myashdrop’); }

User’s Comments Number: Storing it in a meta field for different uses

I am using this within a plugin, but it can be used within your theme’s function file. // Create field to track users’ comments numbers function display_educadme_user_comments_number($user_id) { if( is_user_logged_in() ) { global $wpdb; $user_comments_number = $wpdb->get_var(‘SELECT COUNT(comment_ID) FROM ‘ . $wpdb->comments. ‘ WHERE comment_author_email = “‘ . get_comment_author_email() . ‘”‘); ?> <h3><?php _e(‘Participation in …

Read more

Vimeo video play button color function

I did a couple of things to fix this issue… I added a function that adds a class to my Vimeo iFrame: https://wp-time.com/add-custom-class-to-wordpress-iframe-video/ function video_class($html) { if (preg_match(‘/(vimeo.com)/’, $html)) { return str_replace(‘<iframe’, ‘<iframe class=”video”‘, $html); } else { return $html; } } add_filter(’embed_oembed_html’, ‘video_class’, 99, 4); I implemented some JS to change the properties of …

Read more