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>
Related
I have an array data, for example array data like this:
[0, 1, 2, 3, 4];
I want to foreach array data to view. My first array data will place for headline, second data and others will place for list data. This is my view:
<div class="editor-choice">
<div class="headsection">EDITOR’S CHOICE</div>
<!-- Headline Editor Choice -->
<article class="headline-editor-choice">
<a href="https://www.sportstars.id/read/ole-gunnar-solskjaer-pelatih-man-united-terburuk-setelah-era-sir-alex-ferguson-48Gz3V">
<div class="img-headline-editor-choice">
<img src="https://img.sportstars.id/mpi/800//2021/11/48Gz3V/master_94xHM5T8r5_1941_ole_gunnar_solskjaer.jpg"
alt="img-news">
</div>
</a>
<div class="detail-headline-editor-choice">
Liga Inggris
<span class="date">22 November 2021 13:21 WIB</span>
<div class="title-article title-editor-choice-headline">
<a href="https://www.sportstars.id/read/ole-gunnar-solskjaer-pelatih-man-united-terburuk-setelah-era-sir-alex-ferguson-48Gz3V"
class="title" style="-webkit-box-orient: vertical;">Ole Gunnar Solskjaer Pelatih Man United Terburuk
Setelah
Era Sir Alex Ferguson</a>
</div>
</div>
</article>
<!-- List Editor Choice -->
<?php foreach ($editorchoice as $kuy => $val) { ?>
<article class="list-editor-choice">
<div class="img-editor-choice">
<a
href="<?php echo $val['link']; ?>">
<img src="<?php echo image_uri().'/okz/900/'.str_replace("thumb","master",#$val['image_content']); ?>"
alt="img-news">
</a>
</div>
<div class="detail-editor-choice">
<div class="title-article title-editor-choice">
<a href="<?php echo $val['link']; ?>"
class="title" style="-webkit-box-orient: vertical;"><?php echo $val['title']; ?></a>
</div>
<div class="warp-date-article">
<div class="ico-calendar"><img src="<?php echo base_url(); ?>assets/mobile/images/icon/calender.svg">
</div>
<div class="date-article">19 November 2021</div>
</div>
</div>
</article>
<?php } ?>
This is the example of editorchoice data (data from array):
How to make the first array data from $editorchoice to Headline Editor Choice, and second & others data in List Editor Choice?
I use Codeigniter 3
I solved this problem with this code:
<?php if(!empty($editorchoice)):?>
<!-- Editor Choice -->
<div class="editor-choice">
<div class="headsection">EDITOR’S CHOICE</div>
<!-- Headline Editor Choice -->
<article class="headline-editor-choice">
<a href="<?php echo $editorchoice[0]['link']; ?>">
<div class="img-headline-editor-choice">
<img src="<?php echo image_uri().'mpi/800/'.str_replace("thumb","master",$editorchoice[0]['image_content']); ?>" alt="img-news">
</div>
</a>
<div class="detail-headline-editor-choice">
<?php echo #$editorchoice[0]['channel_name']; ?>
<span class="date"><?php echo $editorchoice[0]['timeago']; ?></span>
<div class="title-article title-editor-choice-headline">
<?php echo $editorchoice[0]['title']; ?>
</div>
</div>
</article>
<!-- List Editor Choice -->
<?php $i = 0; foreach ($editorchoice as $key => $value) { ?>
<?php if(!empty($i)):?>
<article class="list-editor-choice">
<div class="img-editor-choice">
<a href="<?php echo $value['link']; ?>">
<img src="<?php echo image_uri().'mpi/800/'.str_replace("thumb","master",$value['image_content']); ?>" alt="img-news">
</a>
</div>
<div class="detail-editor-choice">
<div class="title-article title-editor-choice">
<?php echo $value['title']; ?>
</div>
<div class="warp-date-article">
<div class="ico-calendar"><img src="<?php echo base_url()?>assets/mobile/images/icon/calender.svg"></div>
<div class="date-article"><?php echo #$value['timeago']; ?></div>
</div>
</div>
</article>
<?php endif;?>
<?php $i++; } ?>
</div>
<!-- End Editor Choice -->
Thank you ..
I've been trying to align my checkout columns side by side for hours and finally decided to swallow my pride and ask for help, I can imagine it's something pretty simple but I can not find it,
When I visit here, and add anything to cart to see the problem, the columns are not aligned side to side, just underneath each other.
Running with Bootstrap + WordPress + Woocommerce.
SCREENSHOT
https://ibb.co/bK382Z8
CODE:
<div class="">
<form name="checkout" method="post" class="checkout woocommerce-checkout" action="<?php echo esc_url( wc_get_checkout_url() ); ?>" enctype="multipart/form-data">
<?php if ( $checkout->get_checkout_fields() ) : ?>
<?php do_action( 'woocommerce_checkout_before_customer_details' ); ?>
<div class="row" id="customer_details">
<div class="col-xs-12 col-md-6">
<div class="checkbox-form">
<?php do_action( 'woocommerce_checkout_billing' ); ?>
<?php do_action( 'woocommerce_checkout_shipping' ); ?>
</div>
</div>
<div class="col-xs-12 col-md-6">
<?php do_action( 'woocommerce_checkout_after_customer_details' ); ?>
<h3 id="order_review_heading"><?php _e( 'Your order', '99fy' ); ?></h3>
<?php do_action( 'woocommerce_checkout_before_order_review' ); ?>
<div id="order_review" class="woocommerce-checkout-review-order">
<?php do_action( 'woocommerce_checkout_order_review' ); ?>
</div>
<?php do_action( 'woocommerce_checkout_after_order_review' ); ?>
</div>
</div>
<?php endif; ?>
</form>
The second column that is going under is not in the row, you can see this in HTML. Add the second column inside the row and it should work.
It's roughly supposed to look like this:
<div class="row" id="customer_details">
<div class="col-xs-12 col-md-6">
<div class="checkbox-form">...</div>
</div>
<div class="col-xs-12 col-md-6">
<h3 id="order_review_heading">Your order</h3>
<div id="order_review" class="woocommerce-checkout-review-order">...</div>
</div>
</div>
html code
In this html code, I would like to select the element with <p>utilisé 2X</p>
How can I do ?
Thanks a lot
I have tried on the php code to add a class but I don't find it
<?php
while ($query->have_posts())
{
$query->the_post();
?>
<div class="boxannonces">
<h2><?php the_title(); ?></h2>
<p><br /><?php the_excerpt(); ?></p>
<?php
if ( has_post_thumbnail() ) {
echo '<p>';
the_post_thumbnail("small");
echo '</p>';
}
?>
<p><?php the_category(); ?></p>
<p><?php the_tags(); ?></p>
<p class="date"><small><?php the_date(); ?></small></p>
</div>
<hr />
<?php
}
?>
You don't say how you want to select the HTML code. With CSS so you can style it? You also don't say which <p> contains "utilisé 2X".
Just give whichever <p> it is a class and refer to it that way.
<p class="twice">utilisé 2X</p>
.twice {
/* CSS stuff */
}
Every time I inspect my code, there is a circle that appears. Does anyone know what this is?
Edit 1:
Thank you to Sam I now know that they are text nodes. I am having a little trouble identifying where they are in my code. If anyone can spot them and point them out to me it would be much appreciated.
<?php get_template_part( 'parts/shared/header' ); ?>
<?php
if(have_posts()) : ?>
<div id="main-content">
<div id="inside">
<div class="content">
<div class="container">
<div class="padding_30">
<h1 class="page_header_blog">Blog</h1><br>
<div class="blog_wrapper">
<?php while(have_posts()) : the_post(); ?>
<div class='post'>
<div class='thumbnail'>
<?php the_post_thumbnail(); ?>
<?php echo get_avatar( get_the_author_meta( 'ID' ) , 32 ); ?>
</div>
<h2 class='each_blog_info' id='post-<?php the_ID(); ?>'></h2>
<div class='blog_info'>
<small><i class='fa fa-calendar-o' aria-hidden='true'></i>
<?php the_time('F jS, Y') ?> ❘
<i class='fa fa-user' aria-hidden='true'></i>
<?php the_author() ?> ❘
<?php the_category( ', ' ); ?>
</small>
</div>
<h2 class='blog_title_link'><a href='<?php the_permalink() ?>' rel='bookmark' title='Permanent Link to <?php the_title_attribute(); ?>'>
<?php the_title(); ?></a></h2>
<div class='excerpt'>
<?php the_excerpt(); ?>
</div>
</div>
<?php endwhile; ?>
<?php endif;?>
<div class="text-center"><?php
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'spafix' ),
'next_text' => __( 'Next page', 'spafix' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'spafix' ) . ' </span>',
) );
?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php get_template_part( 'parts/shared/footer' ); ?>
This is the code from my index.php page where the text nodes are apprearing in inspector. They appear after the loop with the div class of 'post'.
This is "text nodes", they are generated by not accurate PHP and contain " ".
These are due to white spaces... Generally when two or more nodes which inline-block property comes together
DISCLAIMER : I did not code the theme. This was made by another developer who left the project and I am making adjustments based on the new requirements. I don't have experience in Wordpress Theming but I can understand codes.
I am making a design in a website and I want to make my logo to be like floating above the Slider layer. I am working on a wordpress theme:
As you can see the Logo 'Red Dela Cruz' is on the top occupying a separate space or div. I want it inside the slider and floating on it like a layer, whenever the slide changes image, logo should still be there. Here is my code:
<div class="slider">
<img src="<?php echo $template_path; ?>images/redlogo_website.png" alt="" class="web-logo"/>
<div id="one-by-one-slider" class="one-by-one-slider">
<ul class="one-by-one-slider-large">
<?php
$args = array(
'post_type' => 'rdc_home',
);
query_posts( $args );
// The Loop
if ( have_posts() ) :
while (have_posts()) :
//the post for declaration
the_post();
?>
<li>
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID, 'thumbnail') ); ?>" alt="<?php the_title(); ?>"/>
<div class="slider-content text-center">
<div class="slider-heading shp-12 slides" data-animation="bounceInDown" data-duration=4 data-delay=1>
<div class="container">
<div class="row">
<div class="col-md-12">
<h1><?php the_title(); ?></h1>
</div>
</div>
</div>
</div>
<div class="slider-heading shp-13 slides" data-animation="bounceInDown" data-duration=6 data-delay=2>
<div class=" container">
<div class="row">
<div class="col-md-12">
<h3><?php the_content(); ?></h3>
</div>
</div>
</div>
</div>
<!-- <div class="slider-heading shp-14 slides" data-animation="bounceInUp" data-duration=8 data-delay=4>
<div class=" container">
<div class="row">
<div class="col-md-12">
For Bookings
</div>
</div>
</div>
</div> -->
</div>
</li>
<?php
endwhile;
endif;
wp_reset_query();
?>
</ul>
<div class="one-by-one-slider-nav">
<ul class="one-by-one-slider-thumbs">
<li class="one-by-one-slider-element"></li>
<?php
$args = array(
'post_type' => 'rdc_home',
);
query_posts( $args );
// The Loop
if ( have_posts() ) :
while (have_posts()) :
//the post for declaration
the_post();
?>
<li></li>
<?php
endwhile;
endif;
wp_reset_query();
?>
</ul>
</div><!-- one-by-one-slider-nav -->
</div><!-- one-by-one-slider -->
</div><!-- slider -->
The logo is on the 2nd line and I haven't done any css on class
web-logo
This should work:
.web-logo {
position:absolute;
}
If the logo goes "behind" the slider, you should add a z-index, and make it higher, untill the image is showing:
.web-logo {
position:absolute;
z-index:2;
}
you can try this one:
.web-logo {
position: absolute;
right: 10px;
top: 10px;
z-index:2;
}