troubleshooting Question

change HTML dom tree with Jquery

Avatar of Jon Imms
Jon ImmsFlag for United States of America asked on
HTMLPHPjQuery
2 Comments1 Solution109 ViewsLast Modified:
I'm trying to alter the default layout for my testimonials section on my WordPress website.

At the moment, it outputs the HTML as

<div class="avia-testimonial_inner">
<div class="avia-testimonial-image"></div>
<div class="avia-testimonial-content"></div>
<div class="avia-testimonial-meta"></div>
</div>

What i want is

<div class="avia-testimonial_inner">
<div class="avia-testimonial-image"></div>
<div class="avia-testimonial-meta"></div>
<div class="avia-testimonial-content"></div>
</div>

I have 2 functions,  The first one works and has the image first, but i cannot get the meta class above the content. What am i doing wrong here?

WEBSITE

//------------------------------
// php -  Testimonial image on top
//------------------------------

function move_image_up_custom_script(){
?>
<script>
jQuery(function() {
    jQuery$('.avia-testimonial-image').prependTo($('.avia-testimonial_inner'));
     });
</script>
<?php
}
add_action('wp_footer', 'move_image_up_custom_script');

    

function add_custom_script(){
?>
<script>
jQuery(function() {
    jQuery$('.avia-testimonial-content').appendTo($('.avia-testimonial_inner'));
     });
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros