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%;
}
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 added a hover effect on a button. The code effect worked perfectly until I added some PHP code inside my page. Everything except the hover effect is working fine. It tried to understand the problem by using console but got no hint.
Here's my code:
CSS:
#secondary-content
{
position: relative;
top: 100vh;
}
#write-blog
{
position: relative;
top: -50%;
z-index: 3;
}
.ghost-button
{
display: inline-block;
width: 200px;
padding: 8px;
color: #fff;
border: 2px solid #fff;
text-align: center;
outline: none;
text-decoration: none;
}
.ghost-button:hover, .ghost-button:active
{
background-color: #fff;
color: #000;
transition: background-color 0.3s ease-in, color 0.3s ease-in;
}
Here's the code inside my body:
<div class="slider fullscreen" data-indicators="false">
<ul class="slides">
<li>
<img src="Includes/images/map2.jpg">
<div class="caption left-align">
<h3 class="light white-text">History doesn't repeats itself,<br>but it does rhyme.</h3>
</div>
</li>
<li>
<div class="caption right-align">
<h1 class="light white-text">First solve the problem.<br>Then, write the code.</h1>
</div>
<img src="Includes/images/sublime_text.jpeg"> <!-- random image -->
</li>
<li>
<div class="caption center-align">
<h4 class="light white-text">Art speaks where words are unable to explain.</h4>
</div>
<img src="Includes/images/art1.jpg">
</li>
<li>
<img src="Includes/images/music2.jpg">
<div class="caption right-align">
<h5 class="light grey-text text-lighten-3">Where words fail, Music speaks.</h5>
</div>
</li>
<li>
<div class="caption left-align">
<h4 class="light white-text">Science is the poetry of<br>reality.</h4>
</div>
<img src="Includes/images/science.jpg"> <!-- random image -->
</li>
</ul>
<div id="write-blog" class="center-align">
<a class="ghost-button" href="">WRITE A BLOG</a>
</div>
</div>
<div id="secondary-content">
<div class="container">
<?php
$blog = DB::getInstance()->get('blogs', array('deletion_status', '=', '0'));
if($blogs = $blog->fetchRecords(2))
{
foreach($blogs as $blog)
{
$date=strtotime($blog->created_on); // changing the format of timestamp fetched from the database, converting it to milliseconds
echo
"<div class='section'>
<div class='row'>
<div class='col s2'>
<blockquote>".
date('M', $date)."<br>".
date('Y d', $date).
"</blockquote>
</div>
<div class='col s8'>
<h5>".ucfirst($blog->title)."</h5>
<h6>".ucfirst($blog->description)."</h6><br>
<div class='row'>
<div class='col s1'>
<i class='material-icons' style='color:grey'>remove_red_eye</i>
</div>
<div class='col s1'>
{$blog->views}
</div>
<div class='col s1 offset-s2'>
<i class='material-icons' style='color:grey'>thumb_up</i>
</div>
<div class='col s1'>
{$blog->likes}
</div>
<div class='col s1 offset-s2'>
<i class='material-icons' style='color:grey'>thumb_down</i>
</div>
<div class='col s1'>
{$blog->dislikes}
</div>
</div>
<div class='divider'></div>
</div>
</div>
</div>";
}
}
?>
</div>
<script src="Includes/js/jquery.min.js"></script>
<script type="text/javascript" src="Includes/js/materialize.min.js"></script>
<script>
$(document).ready(function(){
$('.slider').slider();
});
</script>
The code below the div having id 'secondary-content' is also working fine. What wrong am I doing here?
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">
Below is the code that was put together by my developer but we're still having problems printing uniformly from http://sandboxalleninvestments.com/person/keith-albritton/. It prints fine when printing as a PDF but outside of that, it's all wonky. I'm out of time and running out of hair to pull out. On some printers it works on some days, on other it does not.
<?php get_header(); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
// $post_id = get_the_id();
?>
<style>
#media print {
.container {
width: 100%;
}
.bio__content {
max-width: none;
}
.bio__content p {
font-size:16px !important; }
}
.subheader--bio .tabelize__content h1 {
font-size: 35px !important;
}
.bio__content hr {
margin:0;
}
.bio__content p {
padding:0 30px;
}
} /* #media print */
</style>
<div class="subheader subheader--bio">
<img src="<?php the_field("bio_picture"); ?>" alt="">
<div class="container">
<div class="tableize tableize--middle">
<div class="tableize__cell">
<div class="tabelize__content">
<?php
$first_name = get_field('first_name');
$last_name = get_field('last_name'); ?>
<h1><?php echo $first_name . " " . $last_name ?></h1>
<small><?php the_field('job_title'); ?></small>
</div>
</div>
</div>
</div>
</div>
<main class="main main--inner main--border">
<div class="container">
<div class="bio__content">
<div class="bio__bar">
<ul class="socials list--nostyle">
<?php if (get_field('facebook')) : ?>
<li>
<svg role="img" class="icon icon--fb"><use xlink:href="<?php echo get_template_directory_uri() . '/icons/icons.svg#icon-fb' ?>"></use></svg>
</li>
<?php endif; ?>
<?php if (get_field('instagram')) : ?>
<li>
<svg role="img" class="icon icon--in"><use xlink:href="<?php echo get_template_directory_uri() . '/icons/icons.svg#icon-in' ?>"></use> </svg>
</li>
<?php endif; ?>
</ul>
<?php if(get_field('team')) : ?>
View Team Page
<?php endif; ?>
</div>
<?php the_field('description'); ?>
<hr>
<div class="bio__footer">
Print Bio
</div>
</div>
</div>
</main>
<?php endwhile; endif; ?>
<?php
get_footer();
?>
Here's a screenshot of the problem. You can see that the margins are way off and the font doesn't match the code (size-wise):
http://i.stack.imgur.com/93qDn.jpg
So I am working to make a change on this site. http://www.kbduct.com . One the site there is a png file of a transparent united states logo on the front. I had to add a small awfs logo banner to it and have the viewer be able to click on it so that it can lead to a different site. I added the anchor tags to these items but nothing happens wen you click on it. Heres the index file and the external file for the image.
BTW, I didn't build this site. Im helping to maintain it for the time being.
INDEX:
<?php include('inc/default.php');
$pageTitle = "The Nations Source For Industrial Ducting, Ducts and Ductwork Components - KB Duct";
$pageDisc = "KB Duct is the Nation's source for industrial duct, ducting components and ductwork fittings and supplies. We offer custom built solutions for your industrial needs.";
$pageKeys = "duct, ductwork, ducting, duct work, commercial ducting, industrial ducting, custom ductwork, ductwork supplies, ducting accessories, duct fittings";
?>
<!doctype html>
<html>
<?php include('inc/head.php'); ?>
<body>
<div id="sb-site">
<?php include('inc/maximage.php'); ?>
<?php include('inc/header.php'); ?>
<div class="mainarea">
<a href="http://awfsfair.org/">
<div id="eBanner" style=" position: absolute; right: 380px; top: 310px;">
<?php /*?> <script type='text/javascript' src='http://libs.a2zinc.net/Common/JS/10.6.0.0/a2zWidget.js'></script><script type='text/javascript' id='exWidget'>new a2z.Widget('dGbJ%2fQfPqUA4s%2fDNrIc%2fzt5xiq%2fL4ZoFjVXmdUEcJutOcD9ggxZSCZyU8MZ6cQu6',40297,'http://libs.a2zinc.net/Common/Widgets/ExhibitorBadge.aspx',31,201133,330,200).render();</script>
<?php */?>
</a>
</div>
<div class="wrapper">
<?php include('inc/industry.php'); ?>
<?php include('inc/catatypes.php'); ?>
<div id="mob-only">
<?php include('inc/mobslideup.php'); ?>
</div>
</div>
</div>
<?php include('inc/footer.php'); ?>
</div>
<?php include('inc/mob-menu.php'); ?>
</body>
</html>
MAXIMAGE.PHP:
<div id="maximage">
<div>
<img src="img/Custom-Ductwork-Clamp-Together-Ducting-Shiny-Ducts-BG.jpg" alt="KB Duct is the nation's source for clamp together and flanged industrial ducting and duct parts." />
<div class="in-slide-content" style="display:none;">
<img src="img/nations-source-for-industrial-ducting.png" alt="KB Duct offers custom fabricated industrial ducting solutions.">
</div>
</div>
<div>
<img src="img/shinyduct.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/awfs-nations-source.png">
</div>
</div>
<!-- <div>
<img src="img/kbduct-production.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/nations-source-for-industrial-ducting.png">
</div>
</div>-->
<div>
<img src="img/plasma.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/awfs-nations-source.png">
</div>
</div>
<div>
<img src="img/welding.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/awfs-nations-source.png">
</div>
</div>
<!-- <div>
<img src="img/clamp.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/nations-source-for-industrial-ducting.png">
</div>
</div>-->
<div>
<img src="img/tunnel.jpg" alt="" />
<div class="in-slide-content" style="display:none;">
<img src="img/awfs-nations-source.png">
</div>
</div>
MAXIMAGE CSS ID:
#maximage {
display:block;/* Only use this if you fade it in again after the images load */
position:fixed !important;
z-index:-1;
CSS IN SLIDE CONTENT:
.in-slide-content {
color:#333;
float:right;
font-family:'Helvetica Neue', helvetica;
font-size:60px;
font-weight:bold;
right:20px;
margin:40px;
padding:20px;
position:absolute;
top:20px;
width:700px;
z-index:9999; /* Show above .gradient */
text-shadow: 0 1px 0 #fff;
-webkit-font-smoothing:antialiased;
}
I did some R&D got some thing. May be this help you
There is a id eBanner change inline styling to
position: absolute;
right: 269px;
top: 141px;
z-index: 9999;
height: 100px;
width: 185px;
border: 2px solid red;
Inside this div there is and anchor tag add folloing style
display: block;
width: 181px;
height: 100px;
Once you check it works then you can remove red border