This is how my code looks like. I removed some parts. So, don't worry if you see some syntax error or something like that.
<?php for($i = 0; $i < $num; $i++){ ?>
<div id="my-ads-block">
<div id="my-ads-name">
<?php echo $title[$i]; ?>
</div>
<div id="my-ads-content">
<div id="my-ads-picture">
<a href="<?php echo $picture[$i] ?>">
<img src="/<?php echo $picture[$i] ?>">
</a>
</div>
<div id="my-ads-menu">
<div class="my-ads-buttons"><span>Posted Date: </span><?php echo date_format($date[$i],"F j, Y") ?></div>
<div class="my-ads-buttons"><span>Price: </span><?php setlocale(LC_MONETARY, 'en_CA'); echo money_format('$%!i', $price[$i]); ?></div>
<div class="my-ads-buttons">Edit This Ad</div>
<div class="my-ads-buttons">Delete This Ad</div>
<div class="my-ads-buttons">Open This Ad</div>
</div>
</div>
</div>
<?php } ?>
This is the css
#my-ads-block{
width: 250px;
margin-right: 7px;
float: left;
}
#my-ads-block:nth-child(3n){
margin-right: 0;
}
I print small boxes which contains some informations and one page can have 3 boxes next to each other. So, I would like to explain with some examples.
The code above, should print columns like this
1 2 3
4 5 6
7 8 9
But the problem is, it prints like this:
1 2 3
4 5 6
7
8 9 10
So, after 6th element, something goes wrong and I cannot figure out why. Thank you for your help.
Related
This question already has answers here:
Five equal columns in twitter bootstrap
(47 answers)
Bootstrap - 5 column layout
(20 answers)
Closed 1 year ago.
I would like to put 5 columns next to each other in a .row div.
If i delete the col-sm-6 col-md-3 classes from the divs, and just give a simple .col class, nothing happens also.
I show you a photo of my source code.
If i put a .clearfix div after every 5. col div, why doesnt it works?
echo '<div class="row">';
$otodik = "";
include_once("files/show_products.php");
echo '</div>';
In a while loop:
<?php while($item = mysqli_fetch_assoc($get_items)){ if($otodik%5 == 0) { echo '<div class="clearfix"></div>'; } ?>
<div class="col-sm-6 col-md-3 text-center mb-5">
<a href="<?php echo $host; ?>/webshop/<?php echo $seolink_kat ."/". html($item['termek_seo']); ?>" class="" title="<?php echo html($item['termek_nev']); ?>">
<img data-src="https://gras.hu/images/item/<?php echo html($item['termek_thumb']).t2(); ?>" alt="<?php echo html($item['termek_nev']); ?>" class="img-fluid main_product_thumb lazyload">
</a>
<h2 class="main_item_title">
<?php echo html($item['termek_nev']); ?>
</h2>
</div>
<?php $otodik++; } ?>
<div class="clearfix"></div>
Its much simpler with bootstrap 4 as grid system now supports flexbox. You just need to add class col to every column in a row.
<div class="container">
<div class="row">
<div class="col mx-1">1</div>
<div class="col mx-1">2</div>
<div class="col mx-1">3</div>
<div class="col mx-1">4</div>
<div class="col mx-1">5</div>
</div>
</div>
Why is my code displaying multiple rows instead of 1?
I can upload any number of photos to my site, but it only displays 4 photos across, the 4 most recently uploaded, on the website. I want it to display 4 rows of photos, instead of 1 row.
<div class="profile_box_body">
<?php
if(!empty($RecentPhotos)){
?>
<div class="profile_photos_list row">
<?php
foreach($RecentPhotos as $value){ ?>
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3 media_item block-center">
<div class="profile_photo ">
<!--<a href="javascript:void();" class="clickable" data-toggle="modal" data-target="#myModal">-->
<a href="<?=WATERMARK_FILE!=''?DisplayImageWithWatermark($value):DB_DOMAIN.'uploads/images/'. $value['bigimage']; ?>" data-fancybox="gallery<?php echo $value["aid"] ?>" >
<div class="img-container-large">
<div class="img-responsive-container img-responsive-container--border">
<img src="<?=$value['image']; ?>" class="pImageBorder img-responsive-container__img">
</div>
</div>
<div class="pImageUsername"><b><?=$value['title']; ?></b><br/><?=$value['description']; ?></div>
</a>
</div>
</div>
<?php
}
?>
</div>
<?php
}
else {
?>
<a class="" style="float: none; text-align: center" href='<?=getThePermalink('account/&dll=gallery')?>'><p> <?=$lang_register_page['a14'] ?></p></a>
<?php
}
?>
</div>
This is not a problem with your HTML or CSS. The problem is into your PHP query. You should check first that, is there a limit = 1 called into your query?
EDIT: I realized I was putting dots in front of classes. Please stop downvoting.
I'm trying to create columns in my search results. I want the results to appear in columns of 3.
This is my code:
<div class=".container">
<div class=".row">
<div class=".col-xs-3">
<h2><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><br /><?php the_excerpt(); ?><p>
</div>
</div>
</div>
Nothing happening.
Classes found at: http://tomasjanecek.cz/en/clanky/post/list-of-bootstrap-3-css-classes-with-description
CSS class selectors begin with a . character.
HTML class names do not (well, they can, but it is more trouble than it is worth and the Bootstrap CSS doesn't expect them to).
<div class="container">
<div class="row">
<div class="col-xs-3">
Don't use . character inside HTML tags classes
Try this code:
<div class="container">
<div class="row">
<div class="col-xs-3">
<h2><?php the_title(); ?></h2>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><br /><?php the_excerpt(); ?><p>
</div>
</div>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm facing logo and menu bar alignment no my website.
how can i fix it? sharing images below.
I want to make changes as below image..
What HTML or CSS code that I should Write ?
Continuing our discussion from wordpress.stackexchange.com here and here, if I get it right, what you are trying to do is having the same menu you have when you resize the browser's window size to 1180px, where the logo goes to the center, but instead of having this only when you resize the window to 1180px, you want to have this type of disposal at all time, meaning having the 1180px menu as the site's default menu.
First
So in order to do this, we need to remove the current CSS for the default menu when the screen size is bigger than > 1180px. To do this, go to - style.css:1006 (meaning go to the file style.css line 1006), and remove the following CSS:
Absolute path for this file - http://www.norenge.com/wp-content/themes/accesspress-store/style.css
#site-branding {
width: 20%;
padding-bottom: 5px;
min-height: 60px;
}
Second
Next thing we need to set the style for the menu when it gets at 1180px as the new default menu. In order to do this, go to: - responsive.css:48, an remove the media queries around the code, which currently the code it's something like this:
Absolute path for this file - http://www.norenge.com/wp-content/themes/accesspress-store/css/responsive.css?ver=4.3.1
#media (max-width: 1180px) {
#site-branding {
float: none;
display: inline-block;
text-align: center;
padding-bottom: 5px;
max-width: 320px;
width: 100%;
}
}
And you need to remove the #media query or just put the code outside the #media query, to be only like this:
#site-branding {
float: none;
display: inline-block;
text-align: center;
padding-bottom: 5px;
max-width: 320px;
width: 100%;
}
Third and last
At last, fix the menu centering disposal, go to - style.css:4328 and remove the float:right; property from the id #menu:
Absolute path for this file - http://www.norenge.com/wp-content/themes/accesspress-store/style.css
#menu {
float: right; /* <- REMOVE THIS LINE */
position: relative;
height: 100%;
}
With this being done, the supposed menu from the size 1180px will now become the main default menu. Good luck! :)
Use this CSS for the logo:
.site-logo {
position: absolute;
top:-55px;
left:50%;
margin-left: -150px;
}
You'll want to move the following HTML,
<a class="site-logo" href="http://www.norenge.com/">
<img src="http://www.norenge.com/wp-content/uploads/2015/11/Oranemart-accesspress_store-logo.png" alt="Capital's First Online Super Store">
</a>
to be an immediate descendant of the <section class="home_navigation" element. Then apply text-align: center; to that same section element and it achieves the look you're asking for.
<?php
/**
* The header for our theme.
*
* Displays all of the <head> section and everything up till <div id="content">
*
* #package AccessPress Store
*/
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="profile" href="http://gmpg.org/xfn/11">
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div id="page" class="hfeed site">
<header id="mastheads" class="site-header" role="banner">
<?php if (as_before_top_header_enabled()): ?>
<div class="before-top-header">
<div class="ak-container clearfix">
<?php accesspress_ticker_header_customizer(); ?>
<?php
if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
?>
<div class="welcome-user">
<span class="line">|</span>
<?php _e('Welcome ', 'accesspress-store'); ?>
<a href="<?php echo get_permalink(get_option('woocommerce_myaccount_page_id')); ?>" class="my-account">
<span class="user-name">
<?php echo $current_user->display_name; ?>
</span>
</a>
<?php _e('!', 'accesspress-store'); ?>
</div>
<?php }
?>
<?php if (is_active_sidebar('header-callto-action')): ?>
<div class="header-callto">
<?php dynamic_sidebar('header-callto-action') ?>
</div>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="top-header clearfix">
<div class="ak-container clearfix">
<!-- Cart Link -->
<?php
if (is_woocommerce_activated()):
echo accesspress_wcmenucart();
endif;
?>
<?php
if (function_exists('YITH_WCWL')) {
$wishlist_url = YITH_WCWL()->get_wishlist_url();
?>
<a class="quick-wishlist" href="<?php echo $wishlist_url; ?>" title="Wishlist">
<i class="fa fa-heart"></i>
<?php echo "(" . yith_wcwl_count_products() . ")"; ?>
</a>
<?php
}
?>
<div class="login-woocommerce">
<?php
if (is_user_logged_in()) {
global $current_user;
get_currentuserinfo();
?>
<a href="<?php echo wp_logout_url( home_url() ); ?>" class="logout">
<?php _e(' LogOut', 'accesspress-store'); ?>
</a>
<?php
} else {
?>
<a href="<?php echo get_permalink(get_option('woocommerce_myaccount_page_id')); ?>" class="account">
<?php _e('LogIn', 'accesspress-store'); ?>
</a>
<?php }
?>
</div>
<!-- if enabled from customizer -->
<?php if (!get_theme_mod('hide_header_product_search')) { ?>
<div class="search-form">
<?php get_search_form(); ?>
</div>
<?php } ?>
</div>
</div>
<section class="home_navigation">
<div class="inner_home">
<div class="ak-container clearfix">
<div id="site-branding" class="clearfix">
<?php accesspress_store_admin_header_image() ?>
</div><!-- .site-branding -->
<div class="right-header-main clearfix">
<div class="right-header clearfix">
<!-- if enabled from customizer -->
<div id="toggle">
<div class="one"></div>
<div class="two"></div>
<div class="three"></div>
</div>
<div class="clearfix"></div>
<div id="menu">
<?php
if (is_page('checkout') && get_theme_mod('hide_navigation_checkout')) {
} else {
?>
<nav id="site-navigation" class="main-navigation" role="navigation">
<a class="menu-toggle">
<?php _e('Menu', 'accesspress-store'); ?>
</a>
<?php
wp_nav_menu(array(
'theme_location' => 'primary',
'container_class' => 'store-menu',
'fallback_cb' => 'custom_fallback_menu',
)
);
?>
</nav><!-- #site-navigation -->
<?php } ?>
</div>
</div> <!-- right-header -->
</div> <!-- right-header-main -->
</div>
</div>
</section><!--Home Navigation-->
</header><!-- #masthead -->
<div id="content" class="site-content">
>> this is my header.php code
I really hope there is an easy fix for this. Basically on full screen I want two months to show in a colum, on smaller devices it shifts to 1 column (i am using .col-md-6 for this), with 3 rows total showing 6 months. This works if each div is the same size. The issue arrises when there is a month with less "blocks of days"
see here: https://www.dropbox.com/s/1rrryqzzppql858/months.png?dl=0
is there some sort of vertical-align css that can be used in bootstrap to fix this???
Here is my code:
<?php
$date = date_create("2015-01-01");
$date_end = date_create("2015-07-01");
while ($date < $date_end):?>
<div class="col-md-6 month_border">
<?php echo "<h2>".date_format($date,'F')."<small>".date_format($date,'Y')."</small></h2>"; ?>
<div class="row">
<?php
//date_format($date,'w') Day of week: 0 = Sunday
//date_format($date,'t') Number of days in current month
$weekday = date_format($date,'w');
$total_days = date_format($date,'t');
$days28 = 0;
if ($total_days == 28) {$days28 = 1;}
for ($day_block = 0 - $weekday + 1; $day_block <= $total_days + $days28; $day_block ++):?>
<?php if($day_block > 0 AND $day_block <= $total_days):?>
<div class="col-7split day_block" id="day_block-<?php echo date_format($date,'n')."-".$day_block; ?> "
data-toggle="modal" data-target="#myModal" data-whatever="#mdo">
<div class="row border bg-info">
<?php echo $day_block; ?>
</div>
<div class="row border">
<div class="col-sm-6 shift_text">
<?php if($day_block != 3) { echo "N"; } ?>
</div>
<div class="col-sm-6 compliment_text nopadding hidden-print">
</div>
</div>
<?php else:?>
<div class="col-7split day_block">
<?php endif; ?>
</div>
<?php endfor; ?>
</div>
</div>
<?php date_modify($date,"+1 months"); endwhile; ?>