i working show/hide script works show/hide text, when try put php (script display recent posts [wordpress]) doesn't work. actually, text still shows/hides, php displays (below action on page).
i suspect might have using <span>
s, act weird in general, @ least show/hide. if try put inside <p>
, example, breaks function.
here code. maybe can show me how put php inside, or maybe need new starting point? goal display various things inside basic light show/hide.
html:
<span class="span3">hide</span> <span class="span2">show</span> <p class="alert" >some text inside show/hide</p>
what want put inside show/hide:
<div class="featured-articles"> <?php $args=array( 'tag' => 'feature-left', 'showposts'=>5, 'caller_get_posts'=>1 ); $my_query = new wp_query($args); if( $my_query->have_posts() ) { echo 'today'; while ($my_query->have_posts()) : $my_query->the_post(); ?> <p><a href="<?php the_permalink() ?>" rel="bookmark" title="permanent link <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p> <?php endwhile; } //if ($my_query) wp_reset_query(); // restore global post data stomped the_post(). ?> </div>
css:
body { display: block; } .span3:focus ~ .alert { display: none; } .span2:focus ~ .alert { display: block; } .alert{display:none;}
(origin code author: vector)
if understood question, trying do:
body { display: block; } .span3:focus ~ .alert { display: none; } .span2:focus ~ .alert { display: block; } .alert { display: none; } .span2, .span3 { outline: none; }
<span tabindex="0" class="span3">hide</span> <span tabindex="0" class="span2">show</span> <p class="alert">some text inside show/hide</p>
to insert php should of course such as:
<p class="alert" ><?php echo 'some text inside show/hide'; ?></p>
and, of course, make sure text echoing has html entities encoded.
edit:
after additional explanation, problem layout structure, can't put div
inside of p
. p
tag can not contain block elements. replace p
div
, should ok:
<div class="alert">your featured articles html here</div>
Comments
Post a Comment