I'm using a custom Wordpress theme which is Goblog theme, in which a slider is included (it's not a plugin). The slider worked fine untile one day it stoped working correctly. The only change I could have done about the slider was editing the CSS to add more height, which, I think, isn't the cause of this issue.
Basically everything works great on the slider, unless that the permalinks does not match with the content, and when clicked on, it redirects to another article.
Here is the php for the slider :
<?php if($bpxl_goblog_options['bpxl_home_slider'] == '1') { ?>
<div class="featuredslider flexslider loading">
<ul class="slides">
<?php
$slider_cat = '';
if(!empty($bpxl_goblog_options['bpxl_home_slider_cat'])) {
$slider_cats = $bpxl_goblog_options['bpxl_home_slider_cat'];
$slider_cat = implode(",", $slider_cats);
}
$slider_query = new WP_Query("cat=".$slider_cat."&orderby=date&order=DESC&showposts=3");
?>
<?php if($slider_query->have_posts()) : while ($slider_query->have_posts()) : $slider_query->the_post(); ?>
<li>
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="featured-thumbnail featured-widgetslider">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail('featured');
} else {
echo '<img src="' . get_stylesheet_directory_uri() . '/images/770x360.png" />';
}
?>
<div class="post-inner textcenter">
<header>
<h2 class="title title22">
<?php the_title(); ?>
</h2>
<div class="slider-meta" style="display:none;"><span><?php _e('Ecrit par'); ?></span> <?php the_author(); ?></div>
</header><!--.header-->
</div>
</a>
</li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
</div>
<?php } ?>
The ouput HTML of the current slider (without editing) :
<div class="featuredslider flexslider">
<ul class="slides">
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" class="">
<a href="http://db-super.fr/episode-6-vostfr-dragon-ball-super/" title="Dragon Ball Super : Episode 6 VOSTFR" class="featured-thumbnail featured-widgetslider">
<img width="770" height="360" src="http://db-super.fr/wp-content/uploads/2015/08/DBSUPER-Episode-6-screen-6-770x360.jpg?7ac485" class="attachment-featured wp-post-image" alt="Beerus" draggable="false"> <div class="post-inner textcenter">
<header>
<h2 class="title title22">
Title </h2>
<div class="slider-meta" style="display:none;"><span>Ecrit par</span></div>
</header><!--.header-->
</div>
</a>
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 0; display: block; z-index: 1;" class="">
<a href="http://db-super.fr/episode-5-vostfr-dragonball-super/" title="Dragon Ball Super : Episode 5 VOSTFR" class="featured-thumbnail featured-widgetslider">
<img width="770" height="360" src="http://db-super.fr/wp-content/uploads/2015/08/dbsuper-episode-5-770x360.jpg?7ac485" class="attachment-featured wp-post-image" alt="dbsuper episode 5" draggable="false"> <div class="post-inner textcenter">
<header>
<h2 class="title title22">
Title</h2>
<div class="slider-meta" style="display:none;"><span>Ecrit par</span></div>
</header><!--.header-->
</div>
</a>
</li>
<li style="width: 100%; float: left; margin-right: -100%; position: relative; opacity: 1; display: block; z-index: 2;" class="flex-active-slide">
<a href="http://db-super.fr/marathon-dragonball-z-cinema-grand-rex/" title="Marathon Dragon Ball Z au cinéma Le Grand Rex" class="featured-thumbnail featured-widgetslider">
<img width="770" height="360" src="http://db-super.fr/wp-content/uploads/2015/08/fukkatu-770x360.jpg?7ac485" class="attachment-featured wp-post-image" alt="fukkatu" draggable="false"> <div class="post-inner textcenter">
<header>
<h2 class="title title22">
Title</h2>
<div class="slider-meta" style="display:none;"><span>Ecrit par</span></div>
</header><!--.header-->
</div>
</a>
</li>
</ul>
<ol class="flex-control-nav flex-control-paging"><li><a class="">1</a></li><li><a class="">2</a></li><li><a class="flex-active">3</a></li></ol><ul class="flex-direction-nav"><li><a class="flex-prev" href="#"><i class="fa fa-angle-left"></i></a></li><li><a class="flex-next" href="#"><i class="fa fa-angle-right"></i></a></li></ul></div>
I thought this might be a permalink issue, so I reloaded them. Also thinking it could be a cache issue I tried to desactivate some plugins that could interacts with the slider.
That's why I finally thought this issue came from the php code itself, unfortunately I didn't figured out where was the issue.
Any ideas of what is causing this problem ?
Edit : you can watch the slider here db-super .fr
Edit 2 : This issue is still not solved and i'm still looking for the cause of this problem.
Please try to Replace following line:
<a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>" class="featured-thumbnail featured-widgetslider">
with this one:
<a href="<?php echo esc_url(get_permalink()); ?>" title="<?php the_title_attribute(); ?>" class="featured-thumbnail featured-widgetslider">
Related
Seems like a silly question, but I can't display posts in three columns.
I was using this code with bootstrap, but I can't anymore because it somehow breaks other parts of my page. I had to change it.
<div class="row" style="margin-top:-30px">
<?php
$count=0;
query_posts('posts_per_page=9');
while (have_posts()) : the_post();
?>
<div class="col-sm-4 blog-post thumb">
<?php get_template_part('content-noticias', get_post_format()); ?>
</div>
<?php
$count++;
if($count == 3 || $count == 6 ) echo '</div><div class="row">';
endwhile;
?>
</div>
It would do the work, but not anymore because of that. How to display my posts in columns without bootstrap? Just for information, my content-noticias is:
<div class="noticias">
<?the_post_thumbnail();?>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div><p><?php echo wp_trim_words( get_the_content(), 50 ); ?></p></div>
</div>
</div>
Hey man for row you can use css property flex-flow: row wrap; and for child items flex-basis: 33%; and any of your items in your post loop will be in 3 columns , and you can change flex basis for other mediaquery for change sie on mobile for example, check this out !
.container {
max-width: 1335px;
margin: 0 auto;
}
.grid-row {
display: flex;
flex-flow: row wrap;
justify-content: flex-start;
}
.grid-item {
height: 250px;
flex-basis: 33%;
-ms-flex: auto;
width: 250px;
position: relative;
padding: 10px;
box-sizing: border-box;
background-color: #ededed;
border: 1px solid white;
}
#media(max-width: 1333px) {
.grid-item {
flex-basis: 33.33%;
}
}
#media(max-width: 1073px) {
.grid-item {
flex-basis: 33.33%;
}
}
#media(max-width: 815px) {
.grid-item {
flex-basis: 33%;
}
}
#media(max-width: 555px) {
.grid-item {
flex-basis: 100%;
}
}
<div class='container'>
<div class='grid-row'>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
<div class='grid-item'>
<div class="noticias">
<a href="<?php the_permalink(); ?>">
<?the_post_thumbnail();?>
</a>
<h1 style="margin-top:-30px"><?php the_title(); ?></h1>
<div>
<p>
<?php echo wp_trim_words( get_the_content(), 50 ); ?>
</p>
</div>
</div>
</div>
</div>
</div>
The problem is in your $count if statement:
if($count == 3 || $count == 6 ) echo '</div><div class="row">'; <-- THIS WILL NEVER CLOSE
What you can do is this:
<div class="row" style="margin-top:-30px">
<?php
query_posts('posts_per_page=9');
while (have_posts()) : the_post();
?>
<div class="col-sm-4 blog-post thumb">
<?php get_template_part('content-noticias', get_post_format()); ?>
</div>
<?php endwhile;?>
</div>
Then you can use CSS to make sure your columns stay intact:
.row .blog-post:nth-child(3n+1) {
clear: left;
}
That will make sure that every third element will clear so if one of the columns is longer or shorter, it won't mess with the layout.
I'm trying to create a simple page with CSS Grid.
The result is pretty good before inserting a php function with MySQL.
CSS
.thumbnail
{
margin-bottom: 20px;
padding: 0px;
-webkit-border-radius: 0px;
-moz-border-radius: 0px;
border-radius: 5px;
width: 350px;
}
HTML/PHP
<div class="container text-center">
<br>
<div class="item col-lg-4">
<div class="thumbnail">
<br>
<?php if ($fetch['file_name'] == '') { ?>
<img class="img-fluid" src="../images/missing.png" alt="Sample image" style="height:150px; width:150px;">
<?php } else { ?>
<img class="img-fluid" src="../images/<?php echo $fetch['file_name']; ?>" alt="missing.png" style="height:150px; width:150px;"/>
<?php } ?>
<div class="caption">
<h4><?php echo $fetch['school_name']; ?></h4>
<p><?php echo $fetch['email']; ?></p>
<p class="lead">$21.000</p>
<a class="btn2" href="profileorg.php?Org_ID=<?php echo $fetch['Org_ID'] ?>">View profile</a>
</div>
</div>
</div>
<?php } ?>
</div>
The screenshot is below
This is my problem:
After inserting php function
What I want is grid align like this:
Reference
<div class="container text-center">
<br>
<div class="item col-lg-4">
<div class="thumbnail">
<br>
<?php if ($fetch['file_name'] == '') { ?>
<img class="img-fluid" src="../images/missing.png" alt="Sample image" style="height:150px; width:150px;">
<?php } else { ?>
<img class="img-fluid" src="../images/<?php echo $fetch['file_name']; ?>" alt="missing.png" style="height:150px; width:150px;"/>
<?php } ?>
<div class="caption">
<h4><?php echo $fetch['school_name']; ?></h4>
<p><?php echo $fetch['email']; ?></p>
<p class="lead">$21.000</p>
<a class="btn2" href="profileorg.php?Org_ID=<?php echo $fetch['Org_ID'] ?>">View profile</a>
</div>
</div>
</div>
</div>
probably its because you have inserted extra closing braces. This code will work fine you.
I've been assigned the task to create a 404.php error page. I just started learning everything and this task is quite difficult. So far I have successuflly:
set up github + atom
clone the repository containing some code
set up MAMP + Wordpress and got the database working
trying to organize all the terms and trying to not confuse them
It's only been 4 days since I started from scratch with basically everything.
I managed to get this code into the 404.php:
> <?php
/**
* The template for displaying 404 pages (Not Found).
**/
get_header(); ?>
<div id="bg">
<img src="<?php echo get_bloginfo('template_directory'); ?> \img\Free-Chalkboard-Backgrounds.jpg" alt="background">
</div>
<header class="entry-header">
<center>
<h1 class="entry-title">404 - Not found</h1>
</center>
</header>
<article id="post-0" class="post error404 no-results not-found">
<div class="entry-content">
<p><big>404 - Die Seite konnte nicht gefunden werden.</big></p>
<?php get_search_form(); ?>
<!-- <img class="img-responsive" src="<?php echo $logoUrl; ?>" alt="Logo - <?php echo get_bloginfo('name'); ?>"> -->
<center><img src="<?php echo get_bloginfo('template_directory'); ?> \img\internet-error-404-file-not-found.jpg" alt="404 not-found" />
</center>
</div>
<!-- .entry-content -->
</article>
<!-- #post-0 -->
<footer>
<ul class="list-inline Impressum">
<li> <a href="https://www.th-nuernberg.de/seitenbaum/impressum/page.html" target="blank">
<alt=>Impressum</a> </li>
<li> |
</li>
<li> <a href="https://www.th-nuernberg.de/institutionen/hochschulkommunikation/ohm-shop/agb/page.html" target="blank">
<alt=>AGB</a> </li>
<li> |
</li>
<li> <a href="https://www.th-nuernberg.de/institutionen/language-center/ueber-uns/page.html" target="blank">
<alt=>Über uns</a> </li>
</ul>
</footer>
<?php get_footer(); ?>
And this is the css:
#bg {
position: fixed;
top: -64%;
left: -55%;
width: 200%;
height: 200%;
}
#bg img {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 55%;
min-height: 55%;
}
It looks like this on the localhost-page:
preview of 404
How can I make the other elements be on top of the background? I read several answers but I'm so confused right now that I need a specific hint for my case.
Thanks in advance for helping!
So if i understand you correctly your background is overlapping right now?
I think the property you are searching for is called the z-index.
you probably need to do something like
#bg{
z-index: -1;
}
more info about z-index
Try it once ...
<?php
/**
* The template for displaying 404 pages (Not Found).
**/
get_header(); ?>
<div id="bg">
<img src="<?php echo get_bloginfo('template_directory'); ?> \img\Free-Chalkboard-Backgrounds.jpg" alt="background">
</div>
<header class="entry-header">
<center>
<h1 class="entry-title">404 - Not found</h1>
</center>
</header>
<article id="post-0" class="post error404 no-results not-found">
<div class="entry-content">
<p><big>404 - Die Seite konnte nicht gefunden werden.</big></p>
<?php get_search_form(); ?>
<!-- <img class="img-responsive" src="<?php echo $logoUrl; ?>" alt="Logo - <?php echo get_bloginfo('name'); ?>"> -->
<center><img src="<?php echo get_bloginfo('template_directory'); ?> \img\internet-error-404-file-not-found.jpg" alt="404 not-found" />
</center>
</div>
<!-- .entry-content -->
</article>
<!-- #post-0 -->
<footer>
<ul class="list-inline Impressum">
<li> <a href="https://www.th-nuernberg.de/seitenbaum/impressum/page.html" target="blank">
<alt=>Impressum</a> </li>
<li> |
</li>
<li> <a href="https://www.th-nuernberg.de/institutionen/hochschulkommunikation/ohm-shop/agb/page.html" target="blank">
<alt=>AGB</a> </li>
<li> |
</li>
<li> <a href="https://www.th-nuernberg.de/institutionen/language-center/ueber-uns/page.html" target="blank">
<alt=>Über uns</a> </li>
</ul>
</footer>
<?php get_footer(); ?>
CSS
.bg-img {
background-position: right 45px bottom;
}
#bg {
position: fixed;
top: -64%;
background-position: top center;
left: -55%;
width: 200%;
height: 200%;
}
#bg img {
position: absolute;
top: 0;
background-position: top center;
left: 0;
right: 0;
bottom: 0;
margin: auto;
min-width: 55%;
min-height: 55%;
}
How can I move the logo before the Site Title in WordPress?
I have this code so far:
function smartline_display_site_title() { ?>
<div class='my-logo'>
<img src="<?php bloginfo('template_directory');?>/images/AA.gif">
</div>
<a href="<?php echo esc_url(home_url('/')); ?>"
title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"
rel="home">
<h1 class="site-title"><?php bloginfo('name'); ?></h1>
</a>
<?php
}
Set or Add display: inline-block to .my-logo and .site-title
.my-logo{
display: inline-block;
}
.site-title{
display: inline-block;
}
Based on your website you can move your image to the left
<img src="http://abraham-accountants.co.uk/wp-content/themes/smartline-lite/images/AA.gif" style="float: left;">
DEMO HERE
Navigate to Smartline Lite: header.php file and change the below given code.
Let me know if it works ....
<div id="logo" class="clearfix">
<?php do_action('smartline_site_title'); ?>
<img src="image location" alt="alt title" height="auto" width="auto">
<?php // Display Tagline on header if activated
if ( isset($theme_options['header_tagline']) and $theme_options['header_tagline'] == true ) : ?>
<h2 class="site-description"><?php echo bloginfo('description'); ?></h2>
<?php endif; ?>
</div>
<div id="header-content" class="clearfix">
<?php get_template_part('inc/header-content'); ?>
</div>
</header>
so I am trying to get my posts to be in a grid layout. I will try and demonstrate best I can with where I am at. So the posts are going to want to be in mosaic tiles. I am using this to achieve it:
http://sapegin.github.io/jquery.mosaicflow/
Now because I am building this locally it is difficult to show a live example. I have placed the files within my Wordpress theme and the html page works as per the files to the mosaic demo, yet when I bring the exact same code into a Wordpress page all of the images just sit down the left hand side and not tiling out.
I have removed my style sheets (it is blank anyway) so there is no conflict there. I have tried moving the link to the jQuery and the Javascript files but still no idea? Perhaps I am missing something?
so here is my homepeage code:
<?php get_header(); ?>
<!--<div id="site-description"><?php bloginfo( 'description' ); ?></div>-->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'entry' ); ?>
<?php comments_template(); ?>
<?php endwhile; endif; ?>
<?php get_template_part( 'nav', 'below' ); ?>
<style>
* {
margin:0;
padding:0;
box-sizing:border-box;
}
body {
font-family:"Helvetica Neue", Arial, sans-serif;
}
.mosaicflow__column {
float:left;
}
.mosaicflow__item {
position:relative;
}
.mosaicflow__item img {
display:block;
width:100%;
max-width:500px;
height:auto;
}
.mosaicflow__item p {
position:absolute;
bottom:0;
left:0;
width:100%;
margin:0;
padding:5px;
background:hsla(0,0%,0%,.5);
color:#fff;
font-size:14px;
text-shadow:1px 1px 1px hsla(0,0%,0%,.75);
opacity:0;
-webkit-transition: all 0.4s cubic-bezier(0.23,1,0.32,1);
-moz-transition: all 0.4s cubic-bezier(0.23,1,0.32,1);
-o-transition: all 0.4s cubic-bezier(0.23,1,0.32,1);
transition: all 0.4s cubic-bezier(0.23,1,0.32,1);
}
.mosaicflow__item:hover p {
opacity:1;
}
</style>
<div class="mosaicflow" data-item-height-calculation="attribute">
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-20_5D_1287_Artem_Sapegin.jpg" alt="">
<p>Dessi the Dachshund</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-24_5D_2066_Artem_Sapegin.jpg" alt="">
<p>Tsiri on Baltic Sea</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-10-21_5D_3178_Artem_Sapegin.jpg" alt="">
<p>Ciyar the Saluki</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-26_5D_2551_Artem_Sapegin.jpg" alt="">
<p>Tsiri Having Fun by the Sea</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-26_5D_2323_Artem_Sapegin.jpg" alt="">
<p>Dessi Meets the Sea</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-05-19_5D_9670_Artem_Sapegin.jpg" alt="">
<p>Tsiri the Saluki</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-20_5D_1165_Artem_Sapegin.jpg" alt="">
<p>Dessi on a Waterfall</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="200" src="http://sapegin.github.com/jquery.mosaicflow/img/2011-05-28_5D_4035_Artem_Sapegin.jpg" alt="">
<p>Dessi in Dandelion Field</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-12-09_5D_3758_Artem_Sapegin.jpg" alt="">
<p>New Year Postcard from Tsiri and Ciyar</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-10-21_5D_3422_Artem_Sapegin.jpg" alt="">
<p>Beautiful Afghan Hound Girl</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-10-21_5D_3414_Artem_Sapegin.jpg" alt="">
<p>Running Ciyar and Afgan Girl</p>
</div>
<div class="mosaicflow__item">
<img width="300" height="300" src="http://sapegin.github.com/jquery.mosaicflow/img/2012-08-26_5D_2378_Artem_Sapegin.jpg" alt="">
<p>Dessi Walking on a Sea Shore</p>
</div>
</div>
<script src="jquery.mosaicflow.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!--<?php get_sidebar(); ?>-->
<?php get_footer(); ?>
You need to call jQuery before you call the mosaic flow library, that should fix it.