Chrome issue with wordpress posts - wordpress

I have an issue with my site on Chrome. On firefox everything is ok, but when I open my page with chrome I don't see the first post on page, there is a blank space there when it should be, I can see that this post is in the code when I inspect this page. I'm searching for an answer for few days and don't know why is this happening. Anyone had a problem like that? please help me.
I'm loading my posts with wp query from category, im using also a clip path in css (but I tried to comment in and check page and same issue was there).
<div class="container">
<div class="row">
<div class="col-12">
<h1 class="home-title text-center">Aktualności</h1>
<?php
$query = new WP_Query( array(
'post_type' => 'post',
'post_status' => 'publish',
'category_name' => 'aktualnosci',
'posts_per_page'=> -1 ) ); ?>
<?php if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
<div class="post-short">
<div class="row">
<div class="col-md-6 col-sm-12">
<a href="<?php the_permalink(); ?>">
<img src="<?php echo wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) ); ?>" class="project_pics">
</a>
</div>
<div class="col-md-6 col-sm-12">
<h3 class="post-short_title text-center"><?php the_title(); ?></h3>
<?php the_date('d.m.Y', '<p class="text-center post-date">', '</p>'); ?>
<div class="excerpt">
<?php the_excerpt(); ?>
</div>
</div>
</div>
</div>
<?php endwhile; endif; wp_reset_postdata(); ?>
</div>
</div>
This is my code for displaying posts.
and page is szkola.webwitch.pl if anyone can check it
Thanks.

Related

open the wordpress custom post type permalink in modal window

Normally in wordpress permalink will open to a single page. but this time the goal is to open the custom post type permalink in modal window. I have lots of custom post type, and I only like to apply the modal in the doctor custom post type .
how could I achieve this? here is my code:
<div class="slider-wrapper">
<div class="center-doc">
<!--start connect to db-->
<?php $args = array(
'post_type' => 'doctor',
'posts_per_page' => -1,
'orderby' => 'post_date',
'order' => 'DESC',
'post_status' => 'publish',
);
$posts = get_posts( $args );
foreach ( $posts as $post ): setup_postdata( $post );
?>
<!--end connect to db-->
<div class="slider-box">
<a href="<?php the_permalink(); ?>"> <!-- PERMALINK TO OPEN MODAL-->
<div class="feature-img"> <?php if (has_post_thumbnail()) : ?> <?php the_post_thumbnail(); ?>
<?php else : ?> <img src="<?php echo get_template_directory_uri(); ?>/img/default-img.png" alt="<?php the_title(); ?>">
<?php endif; ?><!--/pro pic-->
</div>
<h6><?php the_title(); ?></h6>
<div class="content"><?php the_excerpt(); ?></div>
</a>
</div>
<!-- MODAL WINDOW TO OPEN WHEN PERMALINK CLICKED-->
<div id="modal" class="modal-window">
<div>
<i class="fa fa-times-circle" aria-hidden="true"></i>
<div class="detail-wraper">
<div class="detail-info">
<h3><?php the_title(); ?></h3>
<div class="details">
<?php the_content(); ?>
</div>
</div>
</div>
</div>
</div>
<?php endforeach; wp_reset_postdata(); ?>
</div>
I am using Wordpress 5.9.3 version.

Can't display custom post type categories on the page

I have a custom post type called "case_studies" and it has 3 categories: "seo", "website-design" and "facebook-advertising".
I have several posts in the main page, and for each post I want to output what categories the post has.
For example, the latest post has a category of "seo" and "facebook-advertising", and I want it to be displayed in the page.
I have tried the get_the_terms(); function but I think I am using it incorrectly.
Here is the code of the page:
<div class="container">
<!--
<div class="category_container">
<p class="category_item" id="all">All</p>
<p class="category_item" id="website">Websites</p>
<p class="category_item" id="facebook">Facebook Ads</p>
<p class="category_item" id="seo">SEO</p>
</div>
-->
<div class="row d-flex">
<?php
$args1 = array( 'post_type' => array('case_studies'), 'order' => 'DESC', 'posts_per_page' => 30, 'orderby' => 'date' );
$loop = new WP_Query( $args1 );
while ( $loop->have_posts() ) {
$loop->the_post();
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($loop->ID));
?>
<div class="col-sm-4">
<div class="case-study-content">
<a href="<?php the_permalink() ?>" class="blog_blocks">
<div class="b_image">
<img src="<?php echo get_the_post_thumbnail_url(); ?>"/>
</div>
<div class="b_h_sec">
<h2><?php the_title(); ?></h2>
<p><?php echo wp_strip_all_tags( get_the_excerpt(), true ); ?></p>
<span class="r_m">Read More</span>
</div>
</a>
</div>
</div>
<?php } ?>
<?php wp_reset_postdata(); ?>
</div>
</div>
Here is how the output looks right now and where I want categories to be displayed.

Wordpress posts page is not showing posts list

Im trying to setup custom posts page. I was trying to use home.php, and custom page template. After that i choose in the setting part "Reading Settings" my blog page. Problem is that when i go on www.domain.tld/blog im getting single blog post page, not a list of blogs. When i switch blog template to some other url, then everything is fine but still is not using custom template. In that case wp are using home.php
home.php
<?php
/**
* Blog listing
*/
?>
<?php get_header() ?>
<div id="blog" class="page_wrapper">
<div class="hedaer_mini_part">
<?php get_template_part('parts/navigation'); ?>
<div class="container">
<hr>
<h1>Blog</h1>
<div class="search">
<?php echo get_search_form( ); ?>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 0;
$query = new WP_Query(array('category_name' => 'blog', 'post_type' => 'post', 'paged' => $paged));
if ($query->have_posts() || $paged >= 1 && $paged <= $wp_query->max_num_pages) :
?>
</div>
</div>
</div>
<div class="blog_lista">
<div class="container">
<div class="news_list_wrapper">
<?php
// Start the loop.
while ($query->have_posts()) : $query->the_post();
?>
<div class="news_list_item ffs-able">
<a href="<?php the_permalink(); ?>">
<div class="row">
<div class="col-sm-5">
<div class="news_list_image">
<!-- <img src="" /> -->
<?php if(has_post_thumbnail()) { ?>
<img src="<?php the_post_thumbnail_url('list_size'); ?>" alt="<?php the_title() ?>" />
<?php } ?>
</div>
</div>
<div class="col-sm-7">
<div class="news_list_content">
<h3 class="title"><?php the_title() ?></h3>
<div class="body">
<?php echo wp_trim_words(get_the_content(), 90); ?>
</div>
<div class="date">
<?php the_time('j. F Y.'); ?>
</div>
</div>
</div>
</div>
</a>
</div>
<?php
// End the loop.
endwhile;
?>
</div>
<div class="news_pagination">
<hr>
<?php the_posts_pagination(array('mid_size' => 1, 'prev_text' => '<', 'next_text' => '>')); ?>
</div>
<?php
else :
echo 'There is no blog posts..';
endif;
?>
</div>
</div>
</div>
<?php get_footer(); ?>
You need to add these codes to index.php and not home.php. That might fix the issue.

Alternating Wordpress Posts

I am using the JointsWP for a Wordpress site that I am creating for a client.
They want the posts to alternate when the posts are looping.
For example, POST1: feature image on the left and title/excerpt on the right; POST2: title/excerpt on the left, feature image on the right. Etc etc.
Has anyone found any luck with this?
<?php
$args = array( 'posts_per_page' => 2, 'offset' => 2, );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
<div class="row">
<div class="large-6 columns">
<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail(); ?>
</a>
</div>
<div class="large-6 columns">
<?php the_date(); ?>
<a href="<?php the_permalink(); ?>">
<h3><?php the_title(); ?></h3>
</a>
<?php the_excerpt(); ?>
</div>
<div class="large-12 columns">
<hr>
</div>
</div>
<?php endforeach; wp_reset_postdata();?>
Never mind people, I found that Zurb has a functionality to accomplish this goal with a simple class.
Just going to create a counter to count the posts and make it a different class.
http://foundation.zurb.com/sites/docs/v/5.5.3/components/grid.html#source-ordering

Wordpress loop only showing one record in query post

I have a Wordpress Site or its Blog section I did a WP_Query post.
The loop is within a custom template its showing only one record while I have few post entries.
I think I have done correctly...
Please do let me why it is not looping the records.
<?php get_header();
?>
<div id="body">
<div class="container">
<div class="row-fluid">
<div class="span9">
<?php
$arr = array(
'post_type' => 'post',
'posts_per_page' => 10,
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'publish'
);
$query = new WP_Query($arr);
if(count($query->posts) > 0):
$i = 0;
?>
<?php while($query->have_posts()): $i++;?>
<?php $query->the_post();
if(has_post_thumbnail(get_the_ID())){
$url_thumbnail = get_the_post_thumbnail(get_the_ID(), 'thumb_700x260', array('alt' => trim(get_the_title())));
$url_thumbnail_news = get_the_post_thumbnail(get_the_ID(), 'thumb_700x260', array('alt' => trim(get_the_title())));
} else {
$url_thumbnail = '<image src="'.get_template_directory_uri().'/images/no-thumbnail.jpg" title="No Thumbnail" alt="Free Nile Theme - Wordpress Theme from ThemeLead" />';
$url_thumbnail_news = '<image src="'.get_template_directory_uri().'/images/no-thumbnail-news.jpg" title="No Thumbnail" alt="Free Nile Theme - Wordpress Theme from ThemeLead" />';
}
?>
<?php if($i==1):?>
<div class="drop-shadow lifted"> <a class="nile-thumnail" href="<?php echo get_permalink(get_the_ID())?>" title="<?php the_title()?>"><?php echo $url_thumbnail;?></a> </div>
<div class="the_post">
<h2 class="bj-title"><a href="<?php echo get_permalink(get_the_ID())?>" title="<?php the_title()?>">
<?php the_title();?>
</a></h2>
<div class="bj-date">
<?php the_date();?>
<?php the_time();?>
</div>
<div class="bj-des">
<?php the_excerpt();?>
</div>
<a href="<?php the_permalink();?>" title="<?php the_title()?>" class="read-more">
<?php _e('Read more', APP_TD);?>
</a> </div>
<?php endif;?>
<?php endwhile;?>
<?php endif;?>
<?php // Reset Query
wp_reset_query(); ?>
<div class="navigation">
<div class="alignleft">
<?php previous_posts_link('« Previous') ?>
</div>
<div class="alignright">
<?php next_posts_link('More »') ?>
</div>
</div>
</div>
<div class="span3"> <?php echo get_default_sidebar();?> </div>
</div>
</div>
</div>
<?php get_footer();?>
Try removing the 'if($i==1)' and corresponding 'endif;' line

Resources