WordPress Query Image Size - css

How can I make the slider box frame bigger within the query for my Church website slider. The $width and $height only changes the size of image. The image on the slider is getting chopped off - I want to show image slider box as big as the frame. Or how can I crop the image so it won't cut it off - to see the full image size click on image to see the post.
I want to make the width of slider box 600 and the height 300 but the letters at the bottom of box keep changing position and doesn't look right.
Website: brbconline.org
<div id="featuredContainer">
<div id="featured">
<ul>
<?php query_posts( 'posts_per_page=5' ); ?>
<?php $recentPosts = new WP_Query(); $recentPosts->query('category_name='. $church_slider .'&showposts= 7'.''); while ($recentPosts->have_posts()) : $recentPosts->the_post(); ?>
<?php $image = ""; $first_image = $wpdb->get_results("SELECT guid FROM $wpdb->posts WHERE post_parent = '$post->ID' "."AND post_type = 'attachment' ORDER BY `post_date` ASC LIMIT 0,1"); if ($first_image) {$image = $first_image[0]->guid;} ?>
<?php $width = "570"; $height = "255"; ?>
<li>
<h2><?php the_title(); ?></h2>
<img class="featimg" src="<?php bloginfo('template_directory'); ?>/timthumb.php?src=<?php echo $image ?>&w=<?php echo $width ?>&h=<?php echo $height ?>&zc=1" alt="<?php the_title(); ?>" height="<?php echo $height ?>" width="<?php echo $width ?>" />
</li>
<?php endwhile; ?>
</ul>
</div>
</div> <!--end featuredContainer-->
CSS is here:
/* -----FEATURED STUFF----- */
#featuredContainer {margin:0 0 40px; padding: 0; width:560px;position:relative; height:290px; overflow:hidden; border: 1px solid #666; border-bottom:none;}
#featured {overflow:hidden; width:560px; height:290px; position:relative;}
#featured ul, #featured li{margin:0;padding:0;list-style:none; position:relative; overflow:hidden; width:560px; height:290px;}
#featured li h2 a {position: absolute; bottom:0; left: 0; line-height: 36px; padding:0; text-align:center; font-size: 12px; color: #fff; background-repeat: repeat-x; background-position: left center; width: 100%; font-weight:bold;}
#featured li h2 a {color:#fff;}
span#prevBtn a,
span#prevBtn a:link,
span#prevBtn a:visited,
span#nextBtn a,
span#nextBtn a:link,
span#nextBtn a:visited {
margin: 0;
font-weight:bold;
cursor: pointer;
position: absolute;
font-size:12px;
padding:8px 15px;
background: #6a3b14 url('images/buttonback.jpg') repeat-x center;
line-height:20px;
color:#fff;
font-weight:bold;
outline: none;
}
span#prevBtn a {bottom:0px; left:0px; border-right:1px solid #89642D;}
span#nextBtn a {bottom:0px; right:0px; border-left:1px solid #89642D;}
span#prevBtn a:hover, span#nextBtn a:hover {text-decoration: none; background: #6a3b14 url('images/buttonback.jpg') repeat-x top;}
span#prevBtn a:active, span#nextBtn a:active {background: #6a3b14 url('images/buttonback.jpg') repeat-x bottom;}

Related

Display wp posts horizontally doesn't work in archive template

I'm trying to display my posts horizontally, but I have not managed to get it, it only shows vertically, I see that parts of the html code are repeated.
My code:
<div id="content" class="container-fluid">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="four-columns" class="grid-container" style="display:block;">
<ul class="rig columns-4">
<li itemscope="">
<a href="<?php the_permalink(); ?>"><img src="<?php
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
echo $feat_image;?>" class="attachment-single-post-thumbnail size-single-post-thumbnail wp-post-image" alt="" width="300" height="188">
<h3 itemprop="headline"><?php the_title_attribute(); ?></h3></a></li></ul>
</div>
<?php endwhile; endif; ?>
</div>
My css:
<style>
ul.rig li img {
border-radius: 6px;
}
.mg-breadcrumb-section .overlay {
display: none;
}
img, ul.rig li img {
max-width: 100%;
height: auto;
}
ul.rig li h3 {
margin: 0 0 5px;
text-align: center;
}
#front-list ul li {
list-style: square;
}
#front-list ul, ul.rig li {
margin-bottom: 15px;
}
ul.rig.columns-4 li {
width: 16%;
}
ul.rig li {
margin-right: 10px;
background: #ddd;
font-size: 16px;
border-radius: 6px;
}
.footer3, ul.rig li {
display: inline-block;
}
</style>
This is how it shows up in the browser
what am I doing wrong?

Edit the display of most popular items on my homepage

Currently trying to display 8 of the most popular items in from my shop on the home page in a list (ul, li) form. Problem is, it's not displaying inline. Looks horrible and I can seem to get any of the CSS to change it or rearranging the php code isn't working either. Was wonder if anyone had an insight into what I'm missing here.
Here's the php code:
<div id="popular-items" class="site-content">
<div id="popular-links" class="site-content">
<ul class="popular-list">
<li>
<div class="popular-im">
<?php
$args = array( 'post_type' => 'product', 'stock' => 4, 'posts_per_page' => 8, 'orderby' =>'date','order' => 'DESC' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); global $product;
?>
<a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
<h5><?php the_title(); ?></h5>
<span class="price"><?php echo $product->get_price_html(); ?></span></a><?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
<?php endwhile; ?>
</div>
</li><!-- /span3 -->
</ul><!-- /row-fluid -->
</div>
</div>
And here's the css:
#popular-items {
height: 520px;
background-color: transparent;
border: 1px solid #fd0e35;
position: relative;}
ul.popular-list {
display: inline-block;
list-style-type: none !important;
padding: 0;}
#popular-links {
height: 400px;
width: 1102px;
background-color: transparent;
border: 2px solid lightgreen;
position: relative;
top: 50px;
margin: 0 auto;
padding: 0;}
.popular-im {
left: 400px;
height: 350px;
width: 150px;
margin: 0 0 0 0;
border: 2px solid black;
display: inline-block;
vertical-align: top;
position: relative;
text-transform: none;}
Remove Inline-block from UL and apply it to LI, Below should be ideal code for your problem, with explanation, change height / width as per your layout.
First you may want to highlight area what is popular items and let me guess it is about 600px width.
#popular-list {padding:10px; box-sizing:border-box; width:600px;}
Now let us define UL
ul.popular-list {list-style:none}
Finally Li setup in columns. (with 10px gutter between them)
ul.popular-list li {display:inline-block; width:142.5px; margin-right:10px}
ul.popular-list li:nth-child(4n+4) {margin-right:0}
And right after last li (just before ) put clear class.
Thanks & Regards
Manoj Soni
Something like that will help:
.popular-list{
list-style-type: none;
overflow:hidden;
}
.popular-list li{
display:inline-block;
float:left;
height: 350px;
width: 150px;
}

Unwanted white area

Have a look at the picture: http://i.stack.imgur.com/jkK3u.jpg
I try to create a site title floating above the header image, but there is an unwanted space that I can not erase. Here is my CSS code:
#header {
clear:both;
overflow:hidden;
z-index:1;
position:relative;
max-width:1130px;
margin:10px auto 0;
}
.site_title {
overflow:hidden;
margin-top:50px;
background-color:#c03;
height:40px;
width:50%;
float:left;
}
.st_hidden .site_title {
}
.site_title h1 {
float:left;
padding:0 0 0 10px;
font-size:28px;
font-family:'Segoe UI', 'Lucida Grande', Verdana, Arial, Helvetica, sans-serif;
}
/*site title*/
.site_title h1 a {
color:#fff;
line-height:36px;
}
/* site title */
.site_title h1 .header_logo a {
overflow:hidden;
display:block;
width:100%;
height:36px;
text-indent:-9999px;
}
.site_title h2 {
float:left;
height:20px;
overflow:hidden;
line-height:18px;
padding:10px 0 0 20px;
color:#fff;
font-size:12px;
font-weight:normal;
}
/* site slogan*/
#header_image {
max-width:1130px;
max-height:182px;
margin-bottom:5px;
padding:1px;
border:2px solid #ccc;
margin-top:0px;
}
.st_hidden #header_image {
margin-top:5px;
}
#header_image_border {
overflow:hidden;
width:100%;
height:100%;
}
#header_image_border img {
width:100%;
height:100%;
}
and here is my HTML code:
<div id="header"<?php if($zbench_options['hide_title']!='') echo ' class="st_hidden"'; ?>>
<?php $logo=''; if($zbench_options['logo_url']!='') $logo=' class="header_logo" style="background:url('.$zbench_options['logo_url'].') no-repeat 0 0"'; ?>
<div class="site_title">
<h1 <?php if($logo) echo $logo; ?>><?php bloginfo('name'); ?></h1>
<h2><?php bloginfo('description');?></h2>
<div class="clear"></div>
</div>
<?php if ( get_header_image() != '' ) {
?>
<div id="header_image">
<div id="header_image_border">
<img src="<?php header_image(); ?>" width="1130" height="180" alt="" />
</div>
</div>
<?php } ?>
</div>
The space is caused by this line:
margin-top: 50px
in .site_title tag. You should remove this line. If you want to place the text really on the image and not next to it, add
position: absolute | relative
to the image and set the top attribute - it depends on exactly what you want to get.

z-index is not working for navigation bar

I have a drop-down CSS menu. The drop down <div> should start above the page, behind my fixed navigation bar and when a navigation button is "moused over". It uses a CSS transition to move the submenu down the page, making it visible.
The problem is.. it keeps rendering the submenu above my navigation bar (in terms of z-index). I need it to render behind the navigation bar.
Click here to see the webpage
(The page is intentionally aligned to the left for now - ignore this)
Here is how the HTML is layed out:
<div id="nav">
<ul>
<li>Title 1</li> <!-- has no submenu -->
<li>Title 2
<div>
<!-- Submenu Content -->
</div>
</li>
</ul>
</div>
and here is my CSS:
#nav {
position:absolute;
width:<?php echo ($navbutwidth*$numititles)+($numititles-1); ?>px;
background-color:<?php echo $colnavbg; ?>;
z-index:5 !important;
}
#nav ul {
list-style-type:none;
margin:0;
padding:0;
overflow:hidden;
width:<?php echo $navbarwidth; ?>px;
z-index:3 !important;
}
#nav ul li {
float:left;
}
#nav ul li > a {
width:<?php echo ($navbutwidth-16); ?>px;
height:<?php echo $navbutheight; ?>px;
line-height:<?php echo $navbutheight; ?>px;
display:block;
text-decoration:none;
border-left:1px Solid <?php echo $colnavbutborder; ?>;
padding-left:15px;
background-color:<?php echo $colnavbutbg; ?>;
color:<?php echo $colnavbuttxt; ?>;
border-radius:10px 10px 0px 0px;
}
#nav ul li > a:hover {
background-color:<?php echo $colnavbutbghov; ?>;
color:<?php echo $colnavbuttxthov; ?>;
}
#nav ul li > div {
position:absolute;
top:-<?php echo $navsubbutheight-$navbutheight; ?>px;
left:0px;
width:<?php echo $navsubbutwidth; ?>px;
height:<?php echo $navsubbutheight-1; ?>px;
text-align:left;
display:block;
padding:0;
background-color:<?php echo $colsubnavbutbg; ?>;
border-top:1px Solid #FFF;
border-bottom:1px Solid #FFF;
z-index:1 !important;
-webkit-transition:all 0.2s ease-in-out;
-ms-transition:all 0.2s ease-in-out;
transition:all 0.2s ease-in-out;
}
#nav ul li:hover > div {
top:<?php echo $navbutheight; ?>px;
display:block;
}
#nav ul li > div:hover {
background-color:<?php echo $colnavbutbghov; ?>;
}
Add position: relative; z-index: 1000; to .a1.
Having overflow: hidden on your ul will prevent anything outside that ul from showing up.

Simple CSS Image Hover Question

I'm having problems implementing this code onto my site http://www.some-things.net/category/work/
http://www.sohtanaka.com/web-design/css-on-hover-image-captions/
Can anyone see where I'm going wrong?
I've got it working in coda - but when I try implement it into wordpress, something breaks.
<div style="clear:both"></div>
<div class="gallery">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="portfolioItem">
<?php the_post_thumbnail(); ?>
<span class="desctitle"><h2><?php the_title(); ?></h2>
</span> </div>
<?php endwhile; ?>
</div>
And here is the CSS:
.portfolio {overflow:hidden;}
.gallery {
margin-top:10px;
padding-left:22px;
margin-left:-22px;
margin-bottom:20px;
width:982px;
}
/* .portfolioItem {
float:left;
width:300px;
margin-right:25px;
overflow:hidden;
margin-bottom:5px;
} */
.portfolioItem {
float: left;
overflow: hidden;
position: relative;
margin-right: 25px;
margin-bottom: 5px;
}
.portfolioItem a {
text-decoration: none;
float: left;
}
.portfolioItem a:hover {
cursor: pointer;
}
/* .portfolioItem img {
border:2px;
border-color:000;
border-style:solid; */
/* border:none; */
/* opacity:0.6;filter:alpha(opacity=60);} */
/* .gallery .portfolioItem img:hover {
opacity:1;filter:alpha(opacity=100);}
*/
.portfolioItem a img {
float: left;
margin: 0;
border: none;
}
/* boxes for portfolio item descriptions */
.portfolioItem a:hover .desctitle {
display: block;
font-size: 1.2em;
padding: 0px 0;
background: #111;
filter:alpha(opacity=75);
opacity:.75;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)"; /*--IE 8 Transparency--*/
color: #fff;
position: absolute;
bottom: 0px;
margin: 0;
width: 300px;
border-top: 1px solid #999;
}
/* .desctitle a {
color:white;
padding-left:12px;
}
*/
.portfolioItem a .desctitle { display: none; }
It turned out to be a formatting error - the / linking was all wrong. This is the correct code for anyone else with a similar problem...
<div style="clear:both"></div>
<div class="gallery">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="portfolioItem">
<a href="<?php the_permalink() ?>" class="desctitle" title="<?php the_title();?>"><?php the_post_thumbnail(); ?>
<span class="desctitle"><?php the_title(); ?></a>
</span>
</div>
<?php endwhile; ?>
</div>

Resources