Why is the last part script of script from page-plain-template.php not working in wordpress when loop is being called through functions.php

my page-plain-template.php file

echo "<div style="text-align:left;font-weight:900;font-size:0.95em;margin:1em 0 0 0;line-height:1.2em;">";

echo "<div class="tenant">";
echo "<div class="excerpt">";
the_excerpt();
echo "<a href="" class="read">Read More</a>n";
echo "</div>";
echo "<div class="mainContent">";
the_content();
echo "</div>";
echo "</div>";

/* echo comments_template(); */
echo "</div>";


<script>                 

$('.mainContent').hide();
 $('a.read').click(function () {
 $(this).parent('.excerpt').slideUp(10);
 $(this).closest('.tenant').find('.mainContent').slideDown(10);
 // $('.mainContent').show();
 return false;
 });
</script>

my functions.php file also has the same code but does not call the script (functions.php)

echo "<div style="text-align:left;font-weight:900;font-size:0.95em;margin:1em 0 0 0;line-height:1em;">";

 echo "<div class="tenant">";
 echo "<div class="excerpt">";
 the_excerpt();
 echo "<a href="" class="read">Read More</a>n";
 echo "</div>";
 echo "<div class="mainContent">";
 the_content();
 echo "</div>";
 echo "</div>";

 /* comments_template(); */
 echo "</div>";

I am seeing something like this after loading first three posts “read more” shows full post below

Read more here: Why is the last part script of script from page-plain-template.php not working in wordpress when loop is being called through functions.php

Leave a Reply

Your email address will not be published. Required fields are marked *