Page navigation can't find page 2 - wordpress

I don't know why does page navigation do not work correctly.
There are more than 8 postings, but it shows just 8 postings. And I can't find page number '2' and the text 'next page'. Why?
<script>
$(".m7").show();
</script><div class="ppddff" style="border-bottom:1px solid black; margin-bottom:2px;">
<?php if (have_posts()) : ?>
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<link rel="image_src" href="http://www.wapsmag.com/wp-content/uploads/2013/02/blog_th.jpg" />
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/ko_KR/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<style>
.blttl a{ font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕; color:#000;}
.blttl a:hover { text-decoration:none; color:#000;}
.tagstyle a{ font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕; color:#000;}
.tagstyle a:hover { text-decoration:none; color:#000;}
.ttop { background-color:black;}
.pagg{padding-top:100px; padding-bottom:0px;}
.catttl a { color:#000000; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;}
.catttl a:hover{text-decoration:underline;}
.ttyyuu a { color:#000000; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;}
.ttyyuu a:hover{text-decoration:underline;}
.subm a { margin:0 5px 0 5px; color:#666; text-decoration:none; font-family:Georgia, "Times New Roman", Times, serif;}
.subm a:hover { color:#000000; text-decoration:underline;}
.cover1 { display:none;}
</style>
<div style="width:100%; position:relative; overflow:hidden;">
<div style="width:900px; margin:20px auto; ">
<div style="padding-bottom:20px; margin-bottom:20px; border-bottom:1px solid #666;">
<div style="width:150px; height:210px; float:left; margin-top:10px; margin-right:20px; position:relative;"><?php ciii_category_images(""); ?></div>
<div style="width:730px; height:210px; float:left;">
<div class="blttl fvb" style="font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕, 'Georgia'; font-size:16pt; color:#000; padding-top:10px; margin-bottom:3px; text-align:left;" ><?php single_cat_title(); ?> </div>
<div style="font-size:10pt; color:#999; text-align:left; font-family:Georgia, 'Times New Roman', Times, serif; "class="ttyyuu"> <?php echo category_description( ); ?>
</div>
<div style="width:900px; margin:10px auto; position:relative; height:30px; text-align:center;">
<div class="addthis_toolbox addthis_default_style " style="text-align:center; padding-left:0px;">
<a class="addthis_button_favorites"></a>
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-505280914104c869"></script>
<script>$(".addthis_button_tweet").css("width","90"); </script>
</div>
</div>
<div style="clear:both;"></div>
</div>
<?php while (have_posts()) : the_post(); ?>
<div style="width:900px; margin:0 auto;">
<div style="width:900px; margin:0 auto; padding-top:20px; padding-bottom:10px; text-align:center; font-size:16pt; color:#000; font-family: 'Nanum Myeongjo','NanumMyeongjoExtraBoldWeb',
맑은 고딕;"><?php the_title(); ?></div>
<div style="width:900px; text-align:center; font-size:9pt; color:#999999; font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕;"><?php the_time(); ?></div>
<div style="width:900px; margin:0 auto; line-height:1.8em; font-size:10pt; color:#666666; font-family: 'Nanum Gothic','NanumGothicWeb', 맑은 고딕; padding-bottom:30px;"><?php
the_content(); ?>
</div>
<div style="width:900px; margin:0 auto; padding-top:20px; padding-bottom:20px; border-top:1px solid #CCC; border-bottom:1px solid #CCC; ">
<div style="font-family:Georgia, 'Times New Roman', Times, serif; font-size:12pt; color:#000000; padding-bottom:5px; text-align:left;">Tag <img src="/tagg.jpg" /></div>
<div class="tagstyle" style="font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕, 'Georgia'; font-size:10pt; color:#000; text-align:left;"><?php the_tags( '<div
class="tagstyle">', ', ', '</div>'); ?></div>
</div><div style="height:0px;"></div>
</div>
<div class="blttl fvb" style="font-family: 'Nanum Myeongjo','NanumMyeongjoExtraboldWeb', 맑은 고딕, 'Gerogia'; font-size:16pt; color:#000; padding-top:10px; margin-bottom:3px; text-
align:left;" >
</div></div>
<?php endwhile; ?>
<div style="clear:both;">
</div>
</div>
<div style="padding-top:30px; border-top:1px solid black; width:900px; margin:0 auto;"><?php query_posts(array(
'showposts' => 1,
'orderby' => 'rand',
'category_name' => 'sbanner' //You can insert any category name
));
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php echo get_post_meta($post->ID, 'url', true) ?>" target="_new"/> <?php the_post_thumbnail(); ?></a>
<?php endwhile; endif; ?></div>
</div>
<div class="navvi" style="padding-top:20px; padding-bottom:40px; width:900px; margin:0 auto;"><?php wp_pagenavi(); ?></div>
<?php else : if ( is_category() ) { printf("<div class='center sorry' style='padding:150px 0 150px 0;'>Sorry, but there aren't any posts in the %s category yet.</div>", single_cat_title
('',false));} endif; ?>
</div>
<style>.sorry {font-family: 'Nanum Myeongjo','NanumMyeongjoWeb', 맑은 고딕; font-size:12pt;}
.navvi a { color:#666666;}
.navvi a:hover { color:#000000; text-decoration:underline;}
</style>
</div>

You are doing a second post query in your page, before calling the pagination plugin so it use this query to display pages, not the first/main one.
<div style="padding-top:30px; border-top:1px solid black; width:900px; margin:0 auto;">
<?php query_posts(array(
'showposts' => 1,
'orderby' => 'rand',
'category_name' => 'sbanner' //You can insert any category name
));
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php echo get_post_meta($post->ID, 'url', true) ?>" target="_new"/> <?php the_post_thumbnail(); ?></a>
<?php endwhile; endif; ?></div>
</div>
Before the second query, get the value of wp_pagenavi() (check this to learn how to do it : http://wordpress.org/support/topic/plugin-wp-pagenavi-returning-a-string-not-printing-it-directly)
Then echo this value where you actually call wp_pagenavi();

Related

How can I make my flex-box buttons hover?

I have a flex box with several different buttons, namely, "Shop My Look," social icons, and a comment icon. I'd like them to hover to backgound-color: #ffff; (font) color: #f37761; and border color: #f37761. Applying the :hover doesn't do anything. Any thoughts?
You can find my issue on here: www.rachelclayton.co. It's on the homepage under each post in the post-meta area.
/* HTML */
<?php if(!is_single()) : ?>
<div class="read-more">
<?php esc_html_e( 'Continue Reading', 'alder' ); ?> <i class="fa fa-angle-right" aria-hidden="true"></i>
</div>
<div class="shop-social">
<div class="shop-my-look">
<?php esc_html_e( 'Shop My Look', 'alder' ); ?>
</div>
<?php if(!get_theme_mod('alder_post_share')) : ?>
<div class="post-share">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook"></i></a>
<a target="_blank" href="https://twitter.com/intent/tweet?text=Check%20out%20this%20article:%20<?php print alder_social_title( get_the_title() ); ?>&url=<?php echo urlencode(the_permalink()); ?><?php if(get_theme_mod('alder_twitter')) : ?>&via=<?php echo esc_html(get_theme_mod('alder_twitter')); ?><?php endif; ?>"><i class="fa fa-twitter"></i></a>
<?php $pin_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>
<a data-pin-do="none" target="_blank" href="https://pinterest.com/pin/create/button/?url=<?php echo urlencode(the_permalink()); ?>&media=<?php echo esc_url($pin_image); ?>&description=<?php print alder_social_title( get_the_title() ); ?>"><i class="fa fa-pinterest"></i></a>
</div>
<?php endif; ?>
<?php if(!get_theme_mod('alder_post_comment_link')) : ?>
<div class="meta-comment">
<i class="fa fa-comment"></i>
</div>
<?php endif; ?>
</div>
<?php else : ?>
<?php if(!get_theme_mod('alder_post_share_author')) : ?>
<div class="meta-author">
<?php echo get_avatar( get_the_author_meta('email'), '60' ); ?><span class="by"><?php esc_html_e( 'by', 'alder' ); ?></span> <span class="vcard author"><span class="fn"><?php the_author_posts_link(); ?></span></span>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php if(!get_theme_mod('alder_post_related')) : ?>
<?php if(is_single()) : ?>
<?php get_template_part('inc/templates/post-related'); ?>
<?php endif; ?>
<?php endif; ?>
<?php comments_template( '', true ); ?>
<?php if(!get_theme_mod('alder_post_pagination_hide')) : ?>
<?php if(is_single()) : ?>
<?php get_template_part('inc/templates/post-pagination'); ?>
<?php endif; ?>
<?php endif; ?>
</article>
</div>
/* CSS */
}
.post-meta .shop-social {
display: flex;
clear: both;
}
.post-meta .shop-social .post-share a,
.post-meta .shop-social .meta-comment a {
margin-left: 10px;
}
.post-meta .shop-social .shop-my-look,
.post-meta .shop-social .post-share,
.post-meta .shop-social .meta-comment {
display: contents;
}
.post-meta .shop-social .shop-my-look a {
flex-grow: 3;
}
.post-meta .shop-social a {
background: #ffff;
border: 1px solid #dfdfdf;
color: #2e2e2e;
display: block;
font-size: 11.5px;
font-weight: 400;
height: 40px;
letter-spacing: 2px;
line-height: 40px;
width: 4em;
padding: 0 18px;
text-align: center;
text-transform: uppercase;
}
.post-meta .shop-my-look a {
font-size: 11px;
}
.post-meta .shop-social: hover {
background: #ffff;
border: 1px solid #eee;
color: #f37761;
}
In your CSS you have a space between the : and hover. This would cause the hover not to work.
I added hover through console and it works fine
.shop-my-look a:hover {
backgound-color: #ffff;
color: #f37761;
border color: #f37761.
}

how to use wordpress loop with grid system bootstrap?

i want to show a strip row with two column contain wordpress loop content (title, exrept in green blocs) every row have columns with white and grey background that invert in each row like chess checker .
see the image for more detail.
EDITED ANSWER
I believe this is what you are looking for. This loops through all the posts you have and then sorts them the way your sketch looks.
<div class='container'>
<?php
$args = array(
'post_type' => 'post' // Get only posts
);
$the_query = new WP_Query ( $args ); // build query
$count = $the_query->post_count; // Check number of posts
<style>
.row:nth-child(even) .col-5:nth-child(even) { /* Select every even row and and even post */
background: #ddd;
}
.row:nth-child(odd) .col-5:nth-child(odd) { /* Select every odd row and odd post*/
background: #ddd;
}
</style>
<?php
while ( $the_query -> have_posts() ) : $the_query -> the_post();
$post_index = $the_query->current_post + 1; // $current_post = gets the post index in loop
if ( $post_index % 2 != 0 ) { // Open div if post is odd
echo '<div class="row" style="border: 2px solid red; padding: 20px; margin:30px;">';
}
if ( $post_index % 2 != 0) { // If post is odd then give one class
?>
<div class="col-xs-5 <?php echo "post_$post_index" ?>" style="border: 1px solid green;">
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
</div>
<?php
} else {
?>
<div class="col-xs-5 col-xs-push-2 <?php echo "post_$post_index" ?>" style="border: 1px solid green;">
<h2><?php the_title(); ?></h2>
<p><?php the_excerpt(); ?></p>
</div>
<?php } // End if ( $post_index % 2 != 0)
if ( $post_index % 2 == 0 ) { // Close div if post is even
echo "</div>";
}
endwhile;
wp_reset_postdata();
?>
</div>
<!-- /.container -->
ORIGINAL ANSWER
This is the html you're looking for. Just change the class names to suit your needs. Since it is WordPress loop you have to do if else statements for when to start a new row and when to have a different color for the background.
.row {
border: 2px solid red;
padding: 10px 20px;
margin: 30px 0;
}
.col-xs-5 {
border: 1px solid green;
height: 100px;
}
.gray-bg {
background: #ccc;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<div class="container-fluid">
<div class="row">
<div class="col-xs-5"></div>
<div class="col-xs-5 col-xs-push-2 gray-bg"></div>
</div>
<div class="row">
<div class="col-xs-5 gray-bg"></div>
<div class="col-xs-5 col-xs-push-2"></div>
</div>
<div class="row">
<div class="col-xs-5"></div>
<div class="col-xs-5 col-xs-push-2 gray-bg"></div>
</div>
<div class="row">
<div class="col-xs-5 gray-bg"></div>
<div class="col-xs-5 col-xs-push-2"></div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

wordpress Footer css doesn't work

Footer css appears right on every page except single.php page.. The browsers reads on every page in css:
#sidebar + #wrapper + #footer {
margin-left:18em;
}
but at full post page
#sidebar + #wrapper + #footer {
margin-left: 18em;
}
it doesn't work
Footer css
/* Footer */
#sidebar + #wrapper + #footer {
margin-left: 18em;
}
#media screen and (max-width: 1280px) {
#sidebar + #wrapper + #footer {
margin-left: 0;
}
}
#footer > .inner a {
border-bottom-color: rgba(255, 255, 255, 0.15);
}
#footer > .inner a:hover {
border-bottom-color: transparent;
}
#footer > .inner .menu {
font-size: 0.8em;
color: rgba(255, 255, 255, 0.15);
}
#header + #wrapper + #footer > .inner {
margin: 0 auto;
}
footer.php
<!-- Footer -->
<footer id="footer" class="wrapper style1-alt">
<div class="inner">
<ul class="menu">
<?php if ( ! dynamic_sidebar( 'footer_sidebar' ) ) : ?>
<li>© Untitled. All rights reserved.</li>
<?php endif; ?>
</ul>
</div>
</footer>
<!-- Scripts -->
<?php wp_footer(); ?>
</body>
</html>
single.php
<?php get_header(); ?>
<!-- Wrapper -->
<div id="wrapper">
<!-- One -->
<section id="one" class="wrapper style2 spotlights">
<?php while(have_posts()) : the_post(); ?>
<section>
<div class="content">
<div class="sin_content">
<h2><?php the_title(); ?></h2>
<?php echo do_shortcode("[easy_image_gallery]");
remove_filter( 'the_content', 'easy_image_gallery_append_to_content' ); ?>
</div>
<?php the_content(); ?>
</div>
</div>
</section>
<div class="wordpress_commentss-hd">
<div class="wordpress_commentss">
<?php comments_template(); ?>
</div>
</div>
<?php endwhile; ?>
</section>
</div>
<?php get_footer(); ?>
why it doesn't work on full posts pages while works fine on other pages?
Haha, found it :) You have one too many closing div's. Remove the one in single.php between:
remove_filter( 'the_content', 'easy_image_gallery_append_to_content' ); ?>
</div> <--- That one!
<?php the_content(); ?>

Wordpress sidebar goes wrong way in bootstrap

Basically, i split up the page in 2 columns, and tried inserting sidebar code into the right one (span4). But for some reason, it keeps showing under span8
page code
<div class="row pull-right"><div class="span12" id="hdimg"></div></div>
<div class="row pull-right" id="pgg">
<div class="span8" id="pagecn">
<?php the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<div class="ttl">
<?php if ( is_singular() ) {echo '<h1 class="entry-title">';} else {echo '<h2 class="entry-title">';} ?><a title="<?php printf( __('Read %s', 'blankslate'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a><?php if ( is_singular() ) {echo '</h1>';} else {echo '</h2>';} ?>
</div>
<div id="cn">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
<div class="span4">
<?php if ( is_active_sidebar('primary-widget-area') ) : ?>
<div id="primary" class="widget-area">
<ul class="sid">
<?php dynamic_sidebar('primary-widget-area'); ?>
</ul>
</div>
<?php endif; ?>
</div>
</div>
</div>
<?php get_footer(); ?>
css for it
#hdimg {
width: 948px;
height:185px;
background-image: url(images/banner.jpg);
}
#pgg {
width:948px;
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
#cn {margin-top: 15px;}
link to see live
http://soloveich.com/project3/
#pgg {
width:948px;
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
Remove width
#pgg {
margin-top:4px;
background-color: white;
padding-top: 10px;
padding-bottom: 20px;
}
I see what you tried to do but you used it incorrectly - fix background in a different way
<div class="" id="hdimg"></div>
This is for your header - remove grid class
change #hdimg width to
hdimg { width: 960px !important; }

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