Wordpress reply to comment body appears above metadata - css

I am using a custom theme for WordPress, and I have an issue with comment formatting. Reply comments show the body before the comment metadata (user name and date). This is strange because in the HTML the body is clearly after the metadata.
The following is the HTML code as produced by Wordpress:
<div class="comment-list">
<div id="comment-4" class="comment even thread-even depth-1 parent">
<article id="div-comment-4" class="comment-body">
<footer class="comment-meta">
<div class="comment-author vcard">
<b class="fn">John Seibert</b> <span class="says">says:</span>
</div><!-- .comment-author -->
<div class="comment-metadata">
<a href="http://howtolearnalanguagelikeaboss.com/introduction/#comment-4">
<time datetime="2015-12-08T01:40:19+00:00">December 8, 2015 at 1:40 am</time>
</a>
<span class="edit-link"><a class="comment-edit-link" href="http://howtolearnalanguagelikeaboss.com/wp-admin/comment.php?action=editcomment&c=4">Edit</a></span>
</div><!-- .comment-metadata -->
</footer><!-- .comment-meta -->
<div class="comment-content">
<p>Hi Dave,</p>
<p>Nice web site.</p>
<p>Dad</p>
</div><!-- .comment-content -->
<div class="reply"><a rel='nofollow' class='comment-reply-link' href='http://howtolearnalanguagelikeaboss.com/introduction/?replytocom=4#respond' onclick='return addComment.moveForm( "div-comment-4", "4", "respond", "6" )' aria-label='Reply to John Seibert'>Reply</a></div>
</article><!-- .comment-body -->
<div id="comment-7" class="comment odd alt depth-2">
<article id="div-comment-7" class="comment-body">
<footer class="comment-meta">
<div class="comment-author vcard">
<b class="fn">Dave Seibert</b> <span class="says">says:</span>
</div><!-- .comment-author -->
<div class="comment-metadata">
<a href="http://howtolearnalanguagelikeaboss.com/introduction/#comment-7">
<time datetime="2015-12-31T21:42:56+00:00"> December 31, 2015 at 9:42 pm </time>
</a>
</div><!-- .comment-metadata -->
</footer><!-- .comment-meta -->
<div class="comment-content">
<p>Thanks, Dad!</p>
</div><!-- .comment-content -->
<div class="reply"><a rel='nofollow' class='comment-reply-link' href='http://howtolearnalanguagelikeaboss.com/introduction/?replytocom=7#respond' onclick='return addComment.moveForm( "div-comment-7", "7", "respond", "6" )' aria-label='Reply to Dave Seibert'>Reply</a></div>
</article><!-- .comment-body -->
</div><!-- #comment-## -->
</div><!-- #comment-## -->
</div><!-- .comment-list -->
Yet this is rendered with with the content "Thanks, Dad!" coming before "Dave says" and the date, as shown here: screenshot of metadata following content.
I realized this might be a floating issue, but the only css I have affecting this section is the following:
.comment-author {
font-size: 1.7rem;
line-height: 2.1rem;
float: left;
}
.comment-metadata {
font-size: 1.7rem;
line-height: 2.1rem;
float: right;
font-weight: 300;
font-style: italic;
}
div.comment {
padding-bottom: 4em;
}
h2.comments-title {
border-style: solid;
border-width: 1px 0 0 0;
margin-top: 2em;
padding-top: .5em;
padding-bottom: 1em;
}
div.reply {
font-size: 1.7rem;
line-height: 2.1rem;
float: right;
border-style: solid;
padding: .1em .3em .1em .3em;
border-width: .1em;
}
Un-floating the .comment-author class does not help, although un-floating the .comment-metadata and div.comment does help, although that changes the design considerably, since then those elements will be left-aligned. Any help would be much appreciated.

You were right in that it was a floating issue, but on the wrong element. Try un-floating .reply. You can fix this with overflow: auto; on the .comment-body class, or by adding a margin to the bottom of each comment.

Related

Footer.php displaying different on different pages

I'm trying to update our mobile site over the last week but I'm hitting an issue with the footer. It loads up just fine on the home page but crashes when on a normal page. Both are using the same footer.php file.
The staging site that I'm working on is:
http://premierdism.staging.wpengine.com/
<?php
/**
* The template for displaying the footer.
*
*/
?> <div class="clearfix"></div>
</div><!-- .site_content .inner-wrapper -->
</div><!-- .site_content -->
<?php if(!is_front_page()):?>
<?php if(!is_page(52)):?>
<div class="page-cta">
<h4 style="font-family: Georgia;font-size: 40px !important; font-weight: bold; color: #075aa0;">Free, No Obligation</h4>
<h5 style="font-size: 40px !important; font-weight: 500; line-height: .6 !important; margin-top: 0px; color: #075aa0;;">Disability Evalution</h5>
<hr style="border-top: 1px solid #39393b; width:90%;">
<p style="font-size: 30px !important;">Let us help you determine if you<br>qualify for disability income<p>
<div style="height:20px;"></div>
<a title="Free social Security Evaluation" href="http://premierdism.staging.wpengine.com/contact-us/free-evaluation/">Free Evaluation</a>
</div>
<?php endif;?>
<img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Premier_Bottom_Logos.png" />
<?php else:?>
<div class="home-map">
<div class="inner-wrapper">
<?php
$args = array(
'numberposts' => -1,
'post_parent' => 56,
'post_type' => 'page',
'orderby' => 'title',
'order' => 'ASC'
);
$children = get_children( $args );
?>
<?php if($children):?>
<div class="state-list">
<p style="align:left; Color:#a32a2f; margin-bottom:0px;"><b>Click the map below<br>for more state information</b></p>
<hr style="margin-top: 0px; margin-bottom: 0px; margin-right: 0px; width: 570px; border-top: 2px solid #a32a2f;" />
<p align="left">All 50 states and territories</p>
<a href="https://m.premierdisability.com/the-premier-difference/nationwide-disability-benefits/"><img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Premier_Map.svg" alt="Premier Disability offers nationwide help"/>
<div class="clearfix"></div>
</div>
<?php endif;?>
</div>
</div>
<?php endif;?>
<div class="clearfix"></div>
<div class="site-footer">
<div class="footer-disclamier">
<div class="inner-back">
<div class="inner-wrapper" style="background-color: #e3e3e3; width: 640px; margin: -20px 0px 0px -40px; padding: 20px 0px;">
<p class="sharelink">Keep in touch</p>
<div style="padding-bottom:80px;" class="social relative">
<div style="position: absolute; left: 20%;">
<a class="block left" href="https://www.facebook.com/PremierDisability" target="_blank"><img src="http://premierdism.staging.wpengine.com/wp-content/uploads/2016/09/Facebook-Icon.jpg" style="width:60px;"></a>
<a class="block left" href="https://plus.google.com/110325482012270783070" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/GooglePlus-Icon.png" style="width:60px;"></a>
<a class="block left" href="https://twitter.com/PremierDisSvcs" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/Twitter-Icon.png" style="width:60px;"></a>
<a class="block left" href="https://www.instagram.com/premierdisabilityservices/" target="_blank"><img src="https://m.premierdisability.com/wp-content/uploads/2016/09/Instagram-Icon.png" style="width:60px;"></a>
</div>
<div style="padding: 0px 109px; margin-top: 90px;">
<div class="applink Apple"></div>
</div>
</div>
</div>
</div>
<div class="small-disclaimer"><p style="font-size:12px !important;margin-top: 20px;line-height:1.2;"><b>Disclaimer:</b> We are a privately owned, nationwide advocacy service. Any information you receive on this site is not intended to be, nor should it be construed as, legal advice. Using this website or contacting us does not create any type of legal or fiduciary relationship. Premier Disability Services, LLC is neither affiliated with nor endorsed by the Social Security Administration or any other government agency or entity.</p></div>
</div>
</div>
<div class="copyright">
<div class="inner-back">
<div class="inner-wrapper">
<?php Theme::getCopyright()?>
</div>
</div>
</div>
</div><!-- .site-footer -->
</div><!-- #main .wrapper -->
</div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
You can change margin-top: 90px to padding-top: 90px, in this spot:
<div style="padding: 0px 109px; margin-top: 90px;">
<a href="https://itunes.apple.com/us/app/premier-ssd/id1143571193?mt=8">
<div class="applink Apple"></div>
</a>
<a href='https://play.google.com/store/apps/details?id=com.goodbarber.premierdis&utm_source=global_co&utm_medium=prtnr&utm_content=Mar2515&utm_campaign=PartBadge&pcampaignid=MKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1'>
<div class="applink Google"></div>
</a>
</div>
Try moving the footer php into its own php file. Then simply include the file at the end of the page. I use this and it works.
To do this, take the code from the wp_footer() function and paste it in a new file.
Then include 'new-wp-footer.php'; on pages where it doesn't show up.
Update:
Try to turn on output buffering before you include. Then grab the the contents.
For example,
ob_start();
include('footer.php');
$footer_content = ob_get_clean();
echo $footer_content;

How to limit a user description to a certain amount of characters in a user list?

I'm changing the layout of my "users" page in a Wordpress website here
I would like to limit the numbers of characters of the description to a certain amount, in order to "equalize" the bio of each author (user).
Is it possible?
Here the template code:
<?php
/*
Template Name: Display Contributors and Authors
*/
$args = array(
'role' => 'contributor',
'orderby' => 'post_count',
'order' => 'DESC'
);
$contributors = get_users( $args );
?>
<?php get_header();?>
<div id="main">
<div id="primary" class="three-parts archive">
<div class="widget-title">
<?php the_title(); ?>
</div>
<div id="blog-list" class="blog-category">
<ul>
<?php
foreach($contributors as $contributor)
{
?>
<li style="margin-top: 10px; width:25%;">
<div class="blog-post-image">
<div class="image_fx5">
<a href=<?php echo get_author_posts_url( $contributor->ID ); ?>><?php echo get_avatar( $contributor->user_email, '128' ); ?></a>
</div>
</div>
<!--author-image-->
<div class="blog-post-title-box">
<div class="blog-post-title">
<h2>
<a href=<?php echo get_author_posts_url( $contributor->ID ); ?>><?php echo $contributor->display_name; ?></a>
</h2>
</div>
</div>
<!--author-name-->
<div class="blog-post-content" style="padding-bottom: 0px; text-align: justify;">
<?php echo $contributor->description; ?>
</div>
<div id="author-info" style="margin-top: 0px; padding-left: 0px; padding-right: 0px; border-bottom-width: 0px;">
<div id="author-desc" style="width: 100%;">
<ul class="author-social" style="padding-top: 0px;">
<?php if($contributor->facebook) { ?>
<li style="
margin-top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 25px;
">
<a href="http://facebook.com/<?php echo $contributor->facebook; ?>" class="fb-social-icon" target="_blank">
</a>
</li>
<?php } ?>
<?php if($contributor->twitter) { ?>
<li style="
margin-top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 25px;
">
<a href="https://twitter.com/<?php echo $contributor->twitter; ?>" class="twitter-social-icon" target="_blank">
</a>
</li>
<?php } ?>
<?php if($contributor->google) { ?>
<li style="
margin-top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 25px;
">
<a href="http://plus.google.com/<?php echo $contributor->google; ?>?rel=author" class="google-social-icon" target="_blank">
</a>
</li>
<?php } ?>
<?php if($contributor->pinterest) { ?>
<li style="
margin-top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 25px;
">
<a href="http://www.pinterest.com/<?php echo $contributor->pinterest; ?>?rel=author" class="pinterest-social-icon" target="_blank">
</a>
</li>
<?php } ?>
<?php if($contributor->instagram) { ?>
<li style="
margin-top: 0px;
padding-left: 0px;
padding-right: 0px;
height: 25px;
">
<a href="http://www.instagram.com/<?php echo $contributor->instagram; ?>?rel=author" class="instagram-social-icon" target="_blank">
</a>
</li>
<?php } ?>
</ul>
</div>
</div>
<!--author-desc-->
</li>
<?php } ?>
</ul>
</div>
</div>
<!--primary-->
<div id="secondary">
<?php if (!function_exists('dynamic_sidebar') || !dynamic_sidebar('Category Sidebar')): endif; ?>
</div>
<!--secondary-->
</div>
<!--main-->
<?php get_footer(); ?>
Assuming you mean the description try...
<?php echo substr($contributor->description, 0, strpos($contributor->description, ' ', 150)); ?>
Which will return 150 (you can change this to what you like) characters and also make sure it finishes the last word as well.

Container overlapping to header

I have a problem with my container, it actually overlapping to the header, how do I adjust it in css? It should be under the header with a little margin between header and the container.
see the screenshot here
#myHeader {
position: fixed;
top: 0;
left: 0;
width: 100%;
z-index: 100;
background-color: YELLOW;
box-shadow: 0px 2px 3px #888888;
height: 150px;
opacity:0.95;
filter:alpha(opacity=10);
}
#myContent {
padding-top: 10px;
}
#myContent .row {
background-color: #fff;
}
#myContent h1{
margin-top: 0;
}
<section id="myContent">
<div class="container">
<div class="row">
<div class="col-sm-8 col-md-8 col-lg-8">
<div>
<br />
<?php if ($breadcrumb): ?>
<div id="breadcrumb"><?php print $breadcrumb; ?></div>
<?php endif; ?>
<?php print $messages; ?>
<div id="content" class="column"><div class="section">
<a id="main-content"></a>
<?php print render($title_prefix); ?>
<?php if ($title): ?><h1 class="title" id="page-title"><?php print $title; ?></h1><?php endif; ?>
<?php print render($title_suffix); ?>
<?php if ($tabs): ?><div class="tabs"><?php print render($tabs); ?></div><?php endif; ?>
<?php print render($page['help']); ?>
<?php if ($action_links): ?><ul class="action-links"><?php print render($action_links); ?></ul><?php endif; ?>
<?php print render($page['content']); ?>
<?php print $feed_icons; ?>
</div></div> <!-- /.section, /#content -->
<?php if($is_front):?>
<h2>MISSION & VISION<br /></h2>
<!-- <img src="<?php print(path_to_theme()); ?>/images/Bottom.jpg" alt="" class="img-thumbnail pull-left" style="margin-right: 10px;" /> -->
<div>
Our company comes to trade few years ago but from beginning we start to do only professional projects.
We our not satisfied with just good result. It needs to be perfect.
<br /><br />
That's why we teach our employers still to make them the best in this region.
Every 2 years we give to our employers test from new technologies to make sure that we are leaders on market.
<br /><br />
There is no excuse for fails. Our standards are so high that for us is every time the first rule quality.
<br /><br />
You can see in photogallery our references but they are more. Our company are in touch with partners like QINT, TSN-D or FinishLine...
<br /><br />
Come to our company take prospects to see if our portfolio fit to your vision and after that we can find the best way
how to realize it TOGETHER!
<br /><br />
</div>
<?php endif; ?>
</div>
</div>
the header should be inside your container and give fixed width you container
here is an example:
.container{ width:100%; max-width:500px; margin:0 auto; position:relative; background-color:yellow; padding-top:100px;}
.header{ width:100%; max-width:500px; margin-left:-250px; left:50%; height:100px; background-color:red; position:fixed; top:0px; text-align:center;}
<div class="container">
<div class="header">Header</div>
This is your container<br/>
This is your container<br/>
This is your container<br/>
This is your container<br/>
This is your container<br/>
This is your container<br/>
</div>
I deppared myself with the same problem here and apparently, I solved it using the following sollution:
style="z-index: 1" for the navbar or header;
style="z-index: 0" for the container;
*Reminder: using the "style" inside your html script instead of a css folder linked to it is deprecated, it will work but its a better practice trying to avoid this.

Full-width div with background color

On this page: http://www.tff-bvba.be, I need the grey background behind the picture to be full-width on all resolutions, and the text and picture to be centered on the screen. Everything works ok, except the fact that the background continues to the right, off the screen (scroll to the right, you'll see).
I spent 2 hours looking for a solution but found none that worked for me... This is my code:
HTML:
<div class="wide">
<div class="odd">
<div class="homeimage"><img src="http://www.tff-bvba.be/wp-content/uploads/2013/11/hugo- home.png" alt="hugo-home" class="alignright size-full wp-image-1283" /></div>
<div class="hometext"><h1>Slaag in je materiaalinnovatie</h1>
Plan je een complexe innovatie waarbij de <b>combinatie en vorm van materialen</b> essentieel is? Missen je medewerkers <i>knowhow</i> of heb je tijdelijk versterking nodig?<br /><br />TFF maximaliseert de slaagkans van je project door:
<ul>
<li><b>35 jaar ervaring</b> in slimme materiaalcombinaties</li>
<li>maximaal <b>draagvlak </b>bij je medewerkers</li>
<li>bewezen expertise in<b> technieken en processen</b></li>
</ul>
<a class="bttn" title="Slimme materiaalinnovatie" href="http://www.tff-bvba.be/materiaalinnovatie/">Ontdek ons aanbod</a>
</div>
</div>
</div>
CSS:
.wide {
text-align:left;
font-weight:bold;
background:#ebebeb;
margin-left:-100%;
margin-right:-100%;
margin-bottom: 60px;
height: 465px;
}
.odd {
background-color:#ebebeb;
clear:both;
width:900px;
padding:40px 0 27px 0;
margin: 0 auto;
}
.hometext {
float: left;
width: 500px;
}
.homeimage {
margin-top: 0px;
float: right;
}
Thanks for your help, much appreciated!
Stefaan
I've changed your html and css using firebug in real-time and it works look:
Your problem is the html, your .wide div are placed on the wrong place, i've placed it correctly, and changed a little the CSS, use these html and css:
HTML:
<div id="bdywrapper2">
<div class="wide">
<div class="odd">
<div class="homeimage"><img src="http://www.tff-bvba.be/wp-content/uploads/2013/11/hugo-home.png" alt="hugo-home" class="alignright size-full wp-image-1283"></div>
<div class="hometext">
<h1>Slaag in je materiaalinnovatie</h1>
<p>Plan je een complexe innovatie waarbij de <b>combinatie en vorm van materialen</b> essentieel is? Missen je medewerkers <i>knowhow</i> of heb je tijdelijk versterking nodig?</p>
<p>TFF maximaliseert de slaagkans van je project door:</p>
<ul>
<li><b>35 jaar ervaring</b> in slimme materiaalcombinaties</li>
<li>maximaal <b>draagvlak </b>bij je medewerkers</li>
<li>bewezen expertise in<b> technieken en processen</b></li>
</ul>
<p><a class="bttn" title="Slimme materiaalinnovatie" href="http://www.tff-bvba.be/materiaalinnovatie/">Ontdek ons aanbod</a>
</p></div>
</div>
</div>
<!-- Start of main -->
<div class="main">
<div class="clear"></div>
<!-- Start of dynamic loop -->
<div class="dynoloop">
<!-- ******************************************************************** This is the start of blog loop ********************************************************************-->
<!-- Start of one half first -->
<div class="blog_one_half_first">
<!-- Start of slider wrapper -->
<section class="slider_wrapper">
<!-- Start of slider -->
<section style="overflow: hidden;" class="slider">
<ul style="width: 800%; margin-left: -412px;" class="slides"><li style="width: 412px; float: left; display: block;" class="clone">
<h3>Een tevreden klant vertelt…</h3>
<br>
<p>“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore</p>
<p>Meer klanten</p>
</li>
<li style="width: 412px; float: left; display: block;">
<h3>Daarom werk je met ons</h3>
<br>
<h2>Daarom werk je met ons</h2>
<p>1. Unieke ervaring: <b>materiaalinnovatie + bedrijfsvoering</b></p>
<p>
2. <b>Snelle terugverdientijd</b> door interim dividenden</p>
<p>3. Mensgerichte aanpak: <b>draagvlak bij stakeholders</b><br>
Overtuig jezelf</p>
</li>
<li style="width: 412px; float: left; display: block;">
<h3>Een tevreden klant vertelt…</h3>
<br>
<p>“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore</p>
<p>Meer klanten</p>
</li>
<li style="width: 412px; float: left; display: block;" class="clone">
<h3>Daarom werk je met ons</h3>
<br>
<h2>Daarom werk je met ons</h2>
<p>1. Unieke ervaring: <b>materiaalinnovatie + bedrijfsvoering</b></p>
<p>
2. <b>Snelle terugverdientijd</b> door interim dividenden</p>
<p>3. Mensgerichte aanpak: <b>draagvlak bij stakeholders</b><br>
Overtuig jezelf</p>
</li></ul>
<ol class="flex-control-nav"><li><a class="active">1</a></li><li><a>2</a></li></ol><ul class="flex-direction-nav"><li><a class="prev" href="#">Prev</a></li><li><a class="next" href="#">Next</a></li></ul></section><!-- End of slider -->
<!-- Start of clear fix --><div class="clear"></div>
</section><!-- End of slider wrapper -->
</div><!-- End of one half first -->
<!-- Start of one half -->
<div class="blog_one_half">
<!-- Start of slider wrapper -->
<section class="slider_wrapper">
<!-- Start of slider -->
<section class="slider">
<ul class="slides">
<li style="display: list-item;">
<h3>Een tevreden klant vertelt…</h3>
<br>
<h2>Een tevreden klant vertelt…</h2>
<p>
“Mayser/M.Pore ontwikkelt en produceert metaalschuimen voor toepassingen zoals LED-koeling. TFF beschikt over jarenlange ervaring op dit domein. Ze assisteren ons dagelijks op vlak van kwaliteit, productiviteit en creativiteit.” – Manfred Jordan, CEO Mayser/M.Pore<br>
Meer klanten</p>
</li>
</ul>
</section><!-- End of slider -->
<!-- Start of clear fix --><div class="clear"></div>
</section><!-- End of slider wrapper -->
</div><!-- End of one half -->
<!-- ******************************************************************** This is the emd of blog loop ********************************************************************-->
<div class="clear"></div>
</div><!-- End of dynamic loop -->
</div><!-- End of main -->
<!-- Start of accent bottom -->
<div class="accentbottom">
<!-- Start of accent top -->
<div class="accenttop">
</div><!-- End of accent top -->
</div><!-- End of accent bottom -->
</div>
CSS:
.wide {
text-align:left;
font-weight:bold;
background:#ebebeb;
margin-bottom: 60px;
width: 100%;
height: 465px;
}
Try Below CSS
.main {
margin: 0 auto;
padding-bottom: 60px;
width: 100%;
}
.wide {
background-color: #EBEBEB;
font-weight: bold;
height: 465px;
text-align: left;
}
Simple changes will do the trick for you
remove
margin-left:-100%;
margin-right:-100%;
from class .wide and give odd class 100% width instaed of 900px
Your CSS at present is stretching the bg....!!
EDIT :
edit after the comment : use a wrapper class to wrap your entire text and images, put odd to width:100%, this will ensure better compatibility and ease of CSS flow
HTML
<div class="odd">
<div class="wrapper">
<div class="homeimage">
<img src="" class="alignright size-full wp-image-1283" />
</div>
<div class="hometext">
</div>
</div> <!-- //wrapper -->
</div><!-- //odd-->
CSS
.wrapper{width:90%;margin:0 auto} // this will center the div and not take whole width at the same time

How to display multiple text in lightbox

I have written html portion
<ul class="all-products">
<?php while (have_posts()) :the_post(); ?>
<li class="single-product">
<div class="outer-block">
<div class="inner-block">
<div class="product-image">
<?php echo the_post_thumbnail('products-size'); ?>
</div>
</div>
</div>
<p class="title-product">
<?php the_title();?>
</p>
<div class="product-content">
<?php the_content(); ?>
<a class="show-panel" href="#">more</a>
</div>
<div class="lightbox-panel">
<h3> <?php the_title();?></h3>
<p><?php the_content(); ?> </p>
<p align="center">
<a class="close-panel" href="#">Close this window</a>
</p>
</div>
<div class="lightbox"></div>
</li>
<?php endwhile; ?>
</ul>
in jquery as
<script type="text/javascript">
var $=jQuery.noConflict();
$(document).ready(function(){
$("a.show-panel").click(function(){
$(".lightbox, .lightbox-panel").fadeIn(300);
})
$("a.close-panel").click(function(){
$(".lightbox, .lightbox-panel").fadeOut(300);
})
})
</script>
in css as
.lightbox{
display:none;
background:#000000;
opacity:0.9;
filter:alpha(opacity=90);
position:absolute;
top:0px;
left:0px;
min-width:100%;
min-height:100%;
z-index:1000;
}
.lightbox-panel{
display:none;
position:fixed;
top:100px;
left:50%;
margin-left:-200px;
width:400px;
background:#FFFFFF;
padding:10px 15px 10px 15px;
border:2px solid #CCCCCC;
z-index:1001;
}
Now the issue is that it displays same text (title and content) for all the post in the loop... please help me!!!
When you say $(".lightbox, .lightbox-panel").fadeIn(300);, it calls all lightbox with that class on the page. You need to target specific lightbox to the post.
Something like this
$("a.show-panel").click(function(){
$(this).parent().siblings('.lightbox-panel').fadeIn(300);
})

Resources