Can anybody help me get to the bottom of this?
I have icons for several post types that will be appearing across the screen, the whole thing is supposed to look like this on the page if I can get the icons to show up:
The farthest I have gotten is having every thing BUT the icons on display, here's why:
This is what puts the icons on the page. It's a custom field with some radio buttons for names and the values coordinate to class names in the HTML tags for the icons.
<div class="section-header">
<!-- If user uploaded an image -->
<?php if( !empty($features_section_image) ) : ?>
<img src="<?php echo $features_section_image['url']; ?>" alt="<?php echo $features_section_image['alt']; ?>">
<?php endif; ?>
<h2><?php echo $features_section_title; ?></h2>
<!-- If user added body text -->
<?php if( !empty($features_section_body) ) : ?>
<p class="lead"><?php echo $features_section_body; ?></p>
<?php endif; ?>
</div><!-- section-header -->
<div class="row">
<?php $loop = new WP_Query( array( 'post_type' => 'course_feature', 'orderby' => 'post_id', 'order' => 'ASC' ) ); ?>
<?php while( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="col-sm-2">
<i class="<?php the_field('course_feature_icon'); ?>"></i>
<h4><?php the_title(); ?></h4>
</div><!-- end col -->
<?php endwhile; wp_reset_query(); ?>
</div><!-- row -->
</div><!-- container -->
</section><!-- course-features -->
The html classes are then taken by the CSS file and specified.
/* === CUSTOM ICON SPRITES === */
i.ci {
display: inline-block;
height: 40px;
width: 40px;
background: url('/wp-content/themes/Bootstrap2WordPress/bootstrap2wordpress/assets/img/icon-sprite.png') no-repeat;
}
.ci.ci-computer { background-position: 0 0; }
.ci.ci-watch { background-position: -40px 0; }
.ci.ci-calendar { background-position: -80px 0; }
.ci.ci-community { background-position: -120px 0; }
.ci.ci-instructor { background-position: -160px 0; }
.ci.ci-device { background-position: -200px 0; }
The background for the icon's class assigns the background image url to all the icons, this is because the background is a sprite sheet and the CSS for the individual CSS classes crop all the other sprites out of the sprite sheet. It's a ridiculously complicated way of doing it, I know, but I've got to do it this way.
So, I try it out and I get this.
What do I do?
Use background-image:url(); instead of just background:;
update: It is most likely the lack of url() and not the fact that you used background versus background-image
Related
I want to add a picture above the footer as seen picture below, or you can visit the website: http://creativelab.twofour54.com/en/
Example of the photo from TwoFour54
The website I'm testing it on is wordpress. I tried playing with the footer.php however it works nicely but when I stretch the site (zoom out or in) It gets ruined. I tried to make it static with position tag from CSS but that didnt work.
<div class="cfa" style="margin-left: 200px; width: 100%; z-index: 10;">
<div class="container">
<div class="col-sm-12">
<img src="http://localhost:8080/TESTWORDPRESS/wp-content/uploads/2017/01/Sketch-Book-icon.png">
</div>
</div>
</div>
<?php
/*
Template for Footer
*/
?>
<footer id="footer">
<div class="row clearfix">
<?php
if ( ! dynamic_sidebar ( 'footer_widgets' ) ){
thdglkr_emptysidebar('Footer');
}
?>
</div><!-- row -->
<?php if (_option('footer_menu','1')=='1'){ ?>
<div class="footer-last row mtf clearfix">
<span class="copyright"><?php echo _option('footer_text'); ?></span>
<?php
wp_nav_menu(
array(
'theme_location' => 'secondary',
'menu' => 'Footer Menu',
'container' => 'div',
'container_class' => '' ,
'menu_class' => 'foot-menu',
)
);
}else{?>
<div class="footer-last row mtf clearfix center">
<span class="copyright center"><?php echo _option('footer_text'); ?></span>
<?php } ?>
</div><!-- end last footer -->
</footer><!-- end footer -->
</div><!-- end layout -->
</div><!-- end frame -->
<?php if (_option('footer_gototop')==1): ?>
<div id="toTop"><i class="icon-angle-up"></i></div><!-- Back to top -->
<?php endif; ?>
<?php wp_footer(); ?>
</body>
</html>
note: code above is Footer.php from my test local host
Does anyone have any ideas?
Put your .cfa inside your footer in your html. And in your css:
.cfa {
position: absolute;
top: 0;
left: 200px;
margin-top: -100px; //change this to the height of your image
}
EDIT: Actually it's better if you can remove it from your HTML and just add it via css using a :before pseudo-element if you're using it just for design purposes.
I'm not sure why this is, but my wordpress post isn't actually nested inside the div that the PHP code is nested in.
Here is the code on the html side:
<!-- BLOG -->
<div class="blog" id="blog">
<div class="wrap">
<div class="col-sm-12">
<?php
$args = array( 'numberposts' => 1, 'post_status'=>"publish",'post_type'=>"post",'orderby'=>"post_date");
$postslist = get_posts( $args );
echo '<section id="latest_posts">';
foreach ($postslist as $post) : setup_postdata($post); ?>
<h2><?php the_date(); ?></h2>
<h2> <?php the_title(); ?></h1>
<?php endforeach; ?>
<p><?php the_content();?></p>
</section>
</div>
</div>
</div>
And here is the only CSS affecting this code:
/* BLOG */
.blog {
background-image: url("../images/pat_1_bg.png");
padding-top: 60px;
padding-bottom: 60px;
height: 100%;
}
Any idea why this would be sitting outside of the div? It's almost like it has a positive z-index, which it doesn't. I can change the height of 'blog' as much as I want, and it will indeed affect the height of the div, but the post content is unaffected.
first of all, I found that Question here but the answer won't quite fit in my case, which is why I ask a question, that may seem similar but isn't. If that makes sense somehow :-D
I'm creating a childtheme to the "responsive"-Wordpresstheme from cyberchimps.
For that I needed text to shape in 3 columns, but also to be editable in the backend of the Site. I managed that with CCS:
.col-940{
clear: none;
-webkit-column-count: 3; /* Chrome, Safari, Opera */
-webkit-column-gap: 40px;
-moz-column-count: 3; /* Firefox */
-moz-column-gap: 40px;
column-count: 3;
column-gap: 40px;
}
p {
margin: 5px 0px 0px 0px;
}
That now generates the problem, that the first column starts 5px lower than the following ones. I can't figure out why.
As said above the answer in the other thread will not work, because I also have sub-sites that only use 2 columns, which is why I can't use a defined width.
Above/before the div the text is in there always is just another div.
(PHP)container the text is in:
<?php if( have_posts() ) : ?>
<?php while( have_posts() ) : the_post(); ?>
<?php responsive_entry_before(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php responsive_entry_top(); ?>
<div class="post-entry">
<?php the_content( __( 'Read more ›', 'responsive' ) ); ?>
<?php wp_link_pages( array( 'before' => '<div class="pagination">' . __( 'Pages:', 'responsive' ), 'after' => '</div>' ) ); ?>
</div>
<!-- end of .post-entry -->
<?php responsive_entry_bottom(); ?>
</div><!-- end of #post-<?php the_ID(); ?> -->
<?php
endwhile;
get_template_part( 'loop-nav' );
else :
get_template_part( 'loop-no-posts' );
endif;
?>
(HTML)container as produced by the PHP:
<div id="post-25" class="post-25 page type-page status-publish hentry">
<!--
<h1 class="entry-title post-title">Kontakt</h1>…
-->
<div class="post-entry">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing …
</p>
</div>
<!-- end of .post-entry -->
</div>
<!--end of #post-25 -->
Screens:
Shot of the Situation
Shot with marked problem
You have applied 5px margin-top and the only place that occurs at the top of a column is at the start of the first one. You need to remove this margin-top, perhaps with
.post-entry > p:first-child {
margin: 0;
}
For me, I needed each item in the column to have a fixed height. It also had problems with vertical alignement. I was able to fix the vertical alignment by having a line-height on the item be the desired height of the item and wrapping the content of the item inside a div.
ul {
column-count: 2;
}
ul > li {
line-height: 30px;
}
ul > li > div {
height: 30px;
line-height: 1.2;
}
I'm converting someone's static HTML design to Wordpress, but I run into a problem when working with the titles.
The case is that the title expands downwards, which means that when one title becomes more than one line, the other titles also jump up, even though they are only one line.
This is what happens
This is how I want it
This is the CSS I use to position the titles so the bottom of the title hits the bottom of the image:
.single_title {
font-family:Novecent_norm, arial, helvetica, sans serif;
font-size: 18px;
width: 240px;
color: white;
background-color: purple;
margin-top: -86px;
position: fixed;
}
So the question is: Is there a CSS property that can solve this problem, so extra lines of text get added on TOP of the title instead at the BOTTOM of it?
As requested, the HTML:
<?php get_header(); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="content_container">
<div class="thumb_art">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<div class="thumb_img" style="z-index: 0;">
<?php
if (has_post_thumbnail()) {
the_post_thumbnail();
}?>
</div>
</a></h2>
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<div class="single_title">
<?php the_title();?>
</div></a></h2>
</div>
</div>
<?php endwhile; else: ?>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>
<div class="navigation"> <div class="alignleft"><?php previous_posts_link('« Next Entries') ?></div> <div class="alignright"><?php next_posts_link('Previous Entries »') ?></div></div>
<?php get_footer(); ?>
Make thumb_art position relative and then set bottom to 0 on single_title to get it always stick to the bottom
css
.single_title {
font-family:Novecent_norm, arial, helvetica, sans serif;
font-size: 18px;
width: 240px;
color: white;
background-color: purple;
bottom:0;
position: fixed;
}
And if not already set to relative add this aswell
.thumb_art{
position:relative;//actually any positioning would do
}
Still not entirely sure if I understood your question correctly, if there is something im missing please do tell.
Edit:
This is how it would look like if you had used my method
http://jsfiddle.net/nhewu/
I believe I've correctly sourced an image in html for a (super-basic) wordpress theme I am developing; however it still does not display.
This dialogue:
Img Src on local computer
shows the process so far (whereby I've been reassured the html is correct.)
body of index.php:
<?php
$main_menu_column_top = array(
'theme_location' => 'main-nav-column-top',
'container' => 'nav',
'container_class' => 'alignleft widecol',
'container_id' => 'column-main-nav',
'depth' => 1
);
?>
<div class="leftcolumn">
<div class="logo">
<a href="http://www.petermaurin.com">
<img src="images/pmsplogo.jpg" alt="Peter Maurin Screenprinters"/></a>
</div><!--logo-->
<div>
<ul>
<h1><?php wp_nav_menu ( $main_menu_column_top ); ?></h1>
</ul>
</div>
</div>
<div class="maincontent">
<?php
if (have_posts()) :
while (have_posts()) :
the_post();
the_title();
the_content();
endwhile;
endif;
?>
</div><!-- maincontent -->
functions.php:
<?php
register_nav_menus(
array(
'main-nav-column-top' => 'Main Nav, Top of Header',
'sub-nav-column-bottom' => 'Sub Nav, Bottom of Header',
'footer-nav' => 'Footer Menu'
)
);
css:
* {
margin: 0;
padding: 0;
}
p {
font-family: Times New Roman;
}
body {
font-size: 100%;
font-family: sans-serif;
background: url(images/tshirttexture.jpg) left repeat-y #0099ff;
}
.leftcolumn{
width:365px;
float:left;
}
.maincontent{
background-color:green;
margin-left: 375px;
max-width: 600px;
}
... if anyone can take a look and let me know why my image ('pmsplogo.jpg' on line 26 of index.php) is not displaying, I'd be very grateful!
In the img element the src attribute should look like this
<?php bloginfo( 'template_url' );?>/images/pmsplogo.jpg
So basically the full image url will be:
<img src="<?php bloginfo( 'template_url' );?>/images/pmsplogo.jpg" alt="Peter Maurin Screenprinters"/>
<img src="<?php echo 'dirname(__FILE__)'.'/images/pmsplogo.jpg'?>" />
Dont write with "http://www.yoursitename.com/" in PHP, they can't find source with it.