How insert a DIV at top of current theme? [closed]

As I can see in wp-primer-theme sources: there are do_action( ‘primer_body’ ); on the top of content and do_action( ‘primer_before_header’ ); just below. You can update your child theme functions.php with your own action add_action(‘primer_before_header’, function() { echo ‘<div class=”logo”></div>’; });

How to get a list of users who like a current wordpress post [closed]

According to the code samples in the article _user_liked post meta should hold all the user ids of those who liked it. Something like this should be able to solve it for you <?php $post_id = get_the_ID(); $users_liked = get_post_meta( $post_id, ‘_user_liked’, true ); if ( ” !== $users_liked && ! empty( $users_liked ) ) … Read more

wrap a span tag around author’s post count

It doesn’t appear that wp_list_authors() supplies an appropriate hook to modify anything unfortunately. The next best thing would be to just do a string replace and hope for the best :/ $start_wrapper=”<span class=”author-post-count”>”; // Set our wrapper start tag $end_wrapper=”</span>”; // Set our wrapper end tag $author_html = wp_list_authors( array( // Get Author HTML ‘optioncount’ … Read more

Incrementing PHP variable onclick to display posts by month

Try registering a function handling ajax calls first. // For logged out users add_action( ‘wp_ajax_nopriv_wp280265_pagination’, ‘wp280265_pagination’ ); // For logged in users add_action( ‘wp_ajax_wp280265_pagination’, ‘wp280265_pagination’ ); Define the function. function wp280265_pagination() { $month = $_POST[‘month’]; $year = $_POST[‘year’]; if ($month != ” && $year != ”) get_posts($month, $year); } Define JavaScript. (function($) { $(document.body).on(‘click’, ‘#previous’, … Read more

Different SMTP based on domain

I believe what you need is the phpmailer_init action hook. Here is an something you can do. add_action( ‘phpmailer_init’, ‘custom_smtp_settings’ ); function custom_smtp_settings( $phpmailer ) { $phpmailer->isSMTP(); switch ($_SERVER[‘HTTP_HOST’]) { case ‘example1.com’: //name only, no http $phpmailer->Host=”smtp.example1.com”; $phpmailer->SMTPAuth = true; // Force it to use Username and Password to authenticate $phpmailer->Port = 25; $phpmailer->Username=”example1″; $phpmailer->Password … Read more