Posts are not looping through correctly

I just tested the following example code: <?php $the_query = new WP_Query( array( ‘posts_per_page’ => 12, ‘paged’ => get_query_var(‘paged’, 1) )); if ( $the_query->have_posts() ) { // display #ajax wrapper only if we have posts echo ‘<div id=”ajax”>’; while($the_query->have_posts()) { $the_query->the_post(); ?> <article <?php post_class(); ?>> <div class=”row”> <div class=”col-md-4″><?php the_post_thumbnail(‘medium-thumbnail’); ?> <h2><a class=”post-title” href=”https://wordpress.stackexchange.com/questions/252035/<?php … Read more

How to integrate Bootstrap Grid System in WordPress

Site visitor-facing part of any WordPress site is handled by a theme. Contents of theme (outside of WP conventions for meta information and template structure) are arbitrary. In other words — anything you can do in HTML you can do in a WordPress theme. Naturally this includes CSS/HTML frameworks such as Bootstrap and there are … Read more

Two custom post types divided in two columns inside a bootstrap carousel

You could try something like this. The idea is to check within the loop if the item is even or odd, and for the odd item you open the two-item-slide (display the opening HTML), where for the even you close it. I haven’t tested it but the idea is like this: <article class=”container”> <div class=”row”> … Read more

body_class(); not working with bootstrap navbar fixed top?

Why not use a navwalker to create your bootstrap menu? Try https://github.com/wp-bootstrap/wp-bootstrap-navwalker You can get the fixed-top to add to the menu <nav class=”navbar navbar-default navbar-fixed-top” temscope=”itemscope” itemtype=”http://schema.org/SiteNavigationElement” role=”navigation”> <div class=”container”> <div class=”navbar-header”> <button type=”button” class=”navbar-toggle” data-toggle=”collapse” data-target=”#navbar”> <span class=”sr-only”>Toggle navigation</span> <span class=”icon-bar”></span> <span class=”icon-bar”></span> <span class=”icon-bar”></span> </button> </div> <div class=”collapse navbar-collapse” id=”navbar”> <ul class=”nav … Read more

All of my custom Bootstrap styles are not working in my child theme!

In your child theme’s function.php file, find the enqueue function and add it there instead of using @import in your CSS. For example: function my_scripts_and_styles() { wp_enqueue_style( ‘main-style’, get_stylesheet_uri() ); wp_enqueue_style( ‘bootstrap-style’, get_template_directory_uri() . ‘/css/bootstrap.min.css’, array( ‘main-style’, ”, true ); if ( is_singular() && comments_open() && get_option( ‘thread_comments’ ) ) { wp_enqueue_script( ‘comment-reply’ ); } … Read more

Handling repeater data

Try: $fields = get_field(“updates_list”). And then print_r to see what’s inside. You should have a nice looking array with all repeater fields and values inside. Then, stop using have_rows and get_row and just loop using a foreach loop. get_field() is usually used to retrieve a unique field, but because it’s a repeater field you get … Read more

How to style bootstrap container in wordpress theme?

Why do you need container inside container? You may use single container and to reduce it’s total width, you may specify that in your stylesheet like this: .container{max-width:90%;width:800px} I am just considering 800px width as your requirement. You may use your own values. The purpose of defining the max-width will be to make it responsive … Read more

Bootstrap Carousel HTML structure and funny output [closed]

You have a nested anchor tag. I have never seen that done before. You are wrote this with your code <a href=”#”><a href=”#”></a></div></div></a> I would think that is your problem. Why do you need this first anchor tag? ?php while ($postsSlider->have_posts()) : $postsSlider->the_post(); if ($first) { ?> <a class=”foto_link” href=”https://wordpress.stackexchange.com/questions/290742/<?php the_permalink(); ?>”>//should this be here … Read more

Bootstrap Accordion with Dynamic content WordPress Archives Unique ID

the_ID() is for post IDs, so would only be relevant if you were adding an id attribute to individual posts. For your purposes you can use anything you want, as long as it’s unique to the year, and since years themselves are unique, just use that: $year_current. For example: <div id=”collapse-<?php echo $year_current; ?>” class=”panel-collapse … Read more