Moving Icons within a Footer on a Wordpress site - html

I've been working on a site for a while and coming to the end of the development section with a few little issues that need resolving, but first some backstory!
I'm using a wordpress theme called Oneengine (it's really good if you're wanting to create a parallax site by the way) and within it it includes a wide range of different tools that can be used.
A couple of things I'm in dire need of help with and if anyone could help that would be greatly appreciated, I really at the end of sorting it out and so close to finishing it!
Is there a way to center the social media icons at the bottom of the page?
At the moment I’m only using Twitter & Linkedin and don’t think it will need other social media icons. Due to the amount of icons that can be displayed (but aren’t) the Twitter / Linkedin icons are slightly off. Is there a way to fix this so that the divider in the middle of the two brands is in the middle of the site?
Change the size and positioning of the contact icons?
Is it possible to change the way that they are positioned? For some reason the phone icon is a tad too high and needs lowering (only by a few pixels) as well as being made slightly bigger (again, by a few pixels) Where can I find this and adjust the icons?
Making Social Media icons bigger?
Similar to the contact icons, how would I go about adjusting the size of the social media icons?
Below is the code I'm using for the footer, if anyone could have a look at it and let me know what I need to do to make these amends that would be super cool.
</div><!-- #content -->
<div class="clearfix"></div>
<?php if(is_front_page()){ ?>
<center><footer id="contact" class="site-footer template-wrap" role="contentinfo">
<?php
$color = oneengine_option('footer_blog_color');
$img = oneengine_option('footer_blog_img', false, 'url');
$repeat = oneengine_option('footer_blog_repeat');
$parallax = oneengine_option('footer_blog_parallax');
$cover = oneengine_option('footer_blog_cover');
$bg_repeat = '';
if( $repeat == 1 || $repeat == true){
$bg_repeat = 'background-repeat:no-repeat;';
}else $bg_repeat = 'background-repeat:repeat;';
$bg_cover = '';
if( $cover == 1 || $cover == true){
$bg_cover = 'background-size:cover;';
}else $bg_cover = '';
$bg_img = '';
if( $img ){
$bg_img = 'background-image:url('.$img.');';
}else $bg_img = '';
$img = ( ! empty ( $img ) ) ? ''.$bg_img.'' : '';
$color = ( ! empty ( $color ) ) ? 'background-color:'. $color .';' : '';
$repeat = ( ! empty ( $repeat ) ) ? ''. $bg_repeat .'' : '';
$cover = ( ! empty ( $cover ) ) ? ''. $bg_cover .'' : '';
$parallax = ( ! empty ( $parallax ) ) ? 'background-attachment: fixed;': '';
/** Style Container */
$style = (
! empty( $img ) ||
! empty( $color ) ||
! empty( $repeat ) ||
! empty( $cover ) ||
! empty( $parallax ) ) ?
sprintf( '%s %s %s %s %s', $img, $color, $repeat, $cover, $parallax ) : '';
$css = '';
if ( ! empty( $style ) ) {
$css = 'style="'. $style .'" ';
}
?>
<div class="footer-img" <?php echo $css ?>></div>
<div class="container">
<div class="row">
<?php
$color_title = oneengine_option('footer_blog_title_color');
$color_sub_title = oneengine_option('footer_blog_subtitle_color');
$color_title = ( ! empty ( $color_title ) ) ? 'color:'. $color_title .';' : '';
$color_sub_title = ( ! empty ( $color_sub_title ) ) ? 'color:'. $color_sub_title .';' : '';
/** Style Container */
$title_color = (
! empty( $color_title ) ) ?
sprintf( '%s', $color_title) : '';
$css_title_color = '';
if ( ! empty( $title_color ) ) {
$css_title_color = 'style="'. $title_color .'" ';
}
$sub_title_color = (
! empty( $color_sub_title ) ) ?
sprintf( '%s', $color_sub_title) : '';
$css_sub_title_color = '';
if ( ! empty( $sub_title_color ) ) {
$css_sub_title_color = 'style="'. $sub_title_color .'" ';
}
?>
<div class="col-md-12">
<div class="heading-title-wrapper" style="color">
<h2 class="title" <?php echo $css_title_color ?>><margin-top= 30px><?php echo oneengine_option('footer_blog_title') ?></h2>
<span class="line-title" style="background-color:#65b32e"></span>
<span class="sub-title" <?php echo $css_sub_title_color ?>><?php echo oneengine_option('footer_blog_subtitle') ?></span>
</div>
</div>
<div class="clearfix"></div>
<div class="list-contact-wrapper">
<?php if(oneengine_option('email_footer') != '') {?>
<div class="col-md-4">
<div class="contact-wrapper">
<span class="icon"><i class="fa fa-envelope"></i></span>
<p><?php echo nl2br(oneengine_option('email_footer')); ?></p>
</div>
</div>
<?php } ?>
<?php if(oneengine_option('address_footer') != '') {?>
<div class="col-md-4">
<div class="contact-wrapper">
<span class="icon"><i class="fa fa-map-marker"></i></span>
<p><?php echo nl2br(oneengine_option('address_footer')); ?></p>
</div>
</div>
<?php } ?>
<?php if(oneengine_option('phone_footer') != '') {?>
<div class="col-md-4">
<div class="contact-wrapper">
<span class="icon"><i class="fa fa-phone"></i></span>
<p><?php echo nl2br(oneengine_option('phone_footer')); ?></p>
</div>
</div>
<?php } ?>
</div>
<div class="clearfix"></div>
<?php if(oneengine_option('contact_form') != '') {?>
<div class="contact-form-wrapper">
<h2 class="contact-title"></h2>
<?php echo do_shortcode( oneengine_option('contact_form') ); ?>
</div>
<?php } ?>
</div>
</div>
<div style = "center">
<div class="site-info">
<ul class="social-footer">
<?php if(oneengine_option('twitter') != '') {?>
<li><i class="fa fa-twitter"></i></li>
<?php } ?>
<?php if(oneengine_option('linkedin') != '') {?>
<li><i class="fa fa-linkedin"></i></li>
<?php } ?>
</ul>
<div class="copyright">
<?php echo nl2br(oneengine_option('copyright')); ?>
<br>
</div><!-- .site-info -->
</footer><!-- #colophon -->
<?php } ?>
</div></div><!-- #page -->
<?php wp_footer(); ?>
</body>
</html>
Here the website Im building can be found: http://www.jamiebull.co.uk/Meadows_site/ so you know what I'm talking about.
Thanks for looking!

To centralise your social media icons, you will need to add the following CSS at the bottom of your stylesheet:
.social-footer li {
margin: 0px;
border-right: 0px;
padding-right: 0px;
}
.social-footer li:first-child {
border-right: 1px solid white;
padding-right: 10px;
margin-right: 10px;
}
To increase the size of the contact icons and adjust their line-height, you will need to target each icon using CSS. For example, if you want to increase the size of the phone icon and adjust its top margin, you will need to use the following code:
.fa-phone {
font-size: 25px !important;
line-height: 2 !important;
}
To target the map icon and the envelope icon, you will need to use fa-map-marker and fa-envelope respectively instead of .fa-phone in the code above.
To increase the size of the social media icons in the footer, you will need to add the following CSS at the botoom of your stylesheet:
.social-footer .fa {
font-size: 25px;
}

EDIT: I should note that I'm not familiar with this theme. But many modern and more advanced themes have special theme settings with specific fields for adding to the CSS. Some themes will even use these fields to generate a styles.css automatically.
So depending on the theme you may want to define the CSS for these elements in those specific fields in the theme settings, rather than adding directly to styles.css, which may be overwritten.
Well, it turns out that the contact and social media icons are actually just characters in a font that is included with the theme.
This means you can just add some information to your styles.css and change font-sizes, line-heights, etc. and it will update those icons.
So by adding to or changing your styles.css you can overwrite their sizes/positions. It looks like the CSS for some of these elements is already defined in your styles.css (but this could be generated automatically depending on how the theme works), so look to change them before you add something new.
The footer with the social icons is .social-footer, for which you seem to have defined some CSS in styles.css already. It looks like you have padding:0; defined, but it appears that the theme automatically accounts for the missing icons? If I remove padding:0; then the icons seem to center themselves.
For the social icons themselves, here is the CSS for their size:
.social-footer li {
/* Probably you have some other stuff defined here already...*/
font-size: 18px; /* This line controls the size of the icons. */
}
As for the contact icons, the icons themselves are actually all aligned properly, but I guess the phone icon is just drawn with a little more whitespace in the font itself.
The contact icons themselves are of class fa, while the phone icon specifically is of class fa-phone. If you want to manually move it down, you can add something like this (you don't appear to have fa-phone defined already):
.fa-phone {
font-size: 18px; /* This is what the icons are set to now. Increase to make bigger */
line-height: 2.2; /* This is what the icons are set to now. Increase to move further down */
}
Hopefully this is what you were looking for!
If you ever need to know the class for a particular element or want to play with the CSS on the fly, Google Chrome's element inspector and other dev tools are fantastic. Just hit F12 in Chrome or right click and select "Inspect Element".

Related

Masonry uneven grid with jQuery

I've got a problem and was hoping you guys could help me out;
For a project I'm working on I want to create an uneven grid in a WordPress template. For the grid, I'm using Desandro's Masonry.js which is a lovely library for creating flexible grids.
Currently, I have all wordpress content displayed as a straight horizontal grid, like so:
even grid
However, my eventual goal is to have the grid displayed as following:
uneven grid
To give you an idea of how I currently have my grid setup here's a chunk of the code:
I'm using the following WordPress loop for the majority of the grid display:
<main id="main" class="site-main" role="main">
<?php
if ( have_posts() ) :
if ( is_home() && ! is_front_page() ) : ?>
<?php
endif;
/* Start the Loop */
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content-masonry', get_post_format() );
endwhile;
else :
get_template_part( 'template-parts/content', 'none' );
endif; ?>
Which selects from the following content-part:
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<a href="<?php echo get_permalink( $post->ID ); ?>">
<div class="row">
<div class="grid-item col-xs-12 col-sm-6 col-md-6 grid-item-content-background">
<div class="grid-item-content-background">
<div class="front-page-grid-item-tag">
</div>
<div class="button-container">
<i class="fa-border-circle glyphicon glyphicon-chevron-right"></i>
</div>
<!-- post-tags -->
<div class="tags-container">
<?php $tags = wp_get_post_tags( $post->ID );
$html = '';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "<div class='tag-display tag-icon-{$tag->slug}'></div>";
}
echo $html; ?>
<h4 class="front-page-category">
<?php foreach( (get_the_category()) as $category ) { echo $category->cat_name . ' '; } ?>
</h4>
</div>
<!-- .post-tags -->
<div class="grid-item-content">
<div class="grid-item-content-thumbnail"
<?php
if ( $thumbnail_id = get_post_thumbnail_id()) {
if ($image_src = wp_get_attachment_image_src( $thumbnail_id, 'normal-bg'))
printf('style="background-image: url(%s);"', $image_src[0]);
} ?>>
<div class="frontpage-overlay frontpage-overlay-trigger">
<div class="frontpage-article-text-container">
<h2 class="front-page-title"><?php echo get_the_title(); ?></h2>
<h3 class="front-page-subtitle">
<?php {
$subtitle = get_post_meta ( $post->ID, 'subtitle', $single = true );
if ( $subtitle !== '' ) echo $subtitle;
elseif ( $subtitle == '' ) echo '<!-- no subtitle set -->'; } ?>
</h3>
</div><!-- .front-page-article-text-container -->
</div><!-- .frontpage-overlay -->
</div><!-- .grid-item-content-thumbnail -->
</div><!-- .grid-item-content -->
</div><!-- .grid-item-content-background -->
</div><!-- .grid-item -->
</div><!-- .row -->
</a>
</article><!-- #post-<?php the_ID(); ?> -->
Now I've noticed that Masonry uses absolute positioning on the .grid-item class to position elements from top: 0px and left: 0%. Would it at all be possible to have masonry instead start elements from, say, 40px top on the uneven elements inside the grid? Making the grid effectively uneven?
Normally I would simply encapsulate the left side of the grid within a container with an additional margin-top, but sadly I've been unable to achieve that. I've also tried setting all uneven children of the grid to an additional margin-top using CSS, but that was to no avail either (which probably has something to do with the absolute positioning Masonry does).
I've been fussing about this for hours on end. If somebody could assist me that would be really appreciated!
Thank you!
Update:
Due to the used library using absolute positioning, any CSS edits are uneffective. I assume that I'll be needing a jQuery hack that'll set the top of the first element to top: 40px instead of the top: 0; but I have no clue where to start. If anybody can help me that'd be very much appreciated!
You may be able to leverage the :nth-of-type() CSS selector. If these elements are rendering in the expected order, you would use :nth-of-type(odd) to select the first column. Adding margin-top:40px; to drop every element in that column.
If the grid elements are not rendered in the expected order, you may have to modify Masonry.js or write your own JS to find and modify the top positioning of the left column grid elements.
Okay, so I eventually found the solution by adding the following jQuery:
jQuery( '.grid-item:even' ).css( 'margin-top', '40px' );
Hope it helps somebody!
Thank you all.

Wordpress post grid last posts

how can i create a grid like image? for show last posts
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php $latest_post = get_posts( 'numberposts=4' ); ?>
<?php foreach( $latest_post as $post ) : setup_postdata( $post ); ?>
<?php the_title(); ?><br />
<?php the_content(); ?>
<?php endforeach; ?>
<?php wp_reset_query(); ?>
One option is to use PHP to swap around the position of the image based on whether or not the increment is odd or even, for instance:
$i = 0;
while ( have_posts() ) : the_post();
if ($i % 2 == 0 ) {
// Display two columns with image on left
}
else {
// Display two columns with image on right
}
$i++;
endwhile;
If you're building your theme from scratch I'd suggest using a grid framework to handle your columns, otherwise see if the theme you're using has a grid framework already.
Edit:
There are also ways of doing this without actually having to change the markup of the page. For instance:
Swapping columns (left / right) on alternate rows
In this case you'd be able to generate your post markup without the if statement and just use CSS to swap the position of the image/video.
You can use the masonry technology or you can try this plugin
In your code above you fired two WordPress content loops. I am not sure why you had to fire two loops, although they both will work. First will print the recent posts depending on the number of Posts Per Page you selected via Settings->Reading tab from your WordPress Dashboard and the second one will again print the top 4 recent posts. I am using the first loop to tell you how you can create the attached image like grid.
Below is the PHP/HTML modifications that you have to make:
<?php $count = 1; if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="one-half <?php if( $count++ % 2 == 0 ): echo 'last-col'; endif; ?>">
<?php
// the function below will print the featured image attached to the post
the_post_thumbnail( 'your-featured-image-sizename' ); ?>
</div>
<!-- one-half -->
<div class="one-half">
<span class="post_stamp"><?php the_time( 'j m Y' ); ?></span>
<span class="post_cat"><?php the_category(', '); // This will print News if you filled the post under News Category ?></span>
<h3><?php the_title(); ?></h3>
<?php the_excerpt(); // Insteading of printing the whole content this function will print exceprt only ?>
</div>
<!-- one-half -->
<div class="clearfix"><!-- --></div>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
You would have to put the below given links to your style file:
<style>
.one-half{width: 50%; float: left;}
.last-col{float: right;}
.clearfix{clear: both; overflow: hidden;}
</style>
After making the above changes your posts will be displayed as the attached image. Good Luck (y)

how to create space between anchor tag elements in loop in paging

I'm creating a paging option in my website. The problem is that the paging digits is not align in the appropriate way in fact the images is attached. [This is my image in which number not align correctly
This is output of my paging numbers:
This is my code.
<section>
<div class="container" style="padding-bottom:10px; font-size:20px;">
<?php $sql1 = "SELECT * FROM videos ";
$query = $conn->query($sql1);
// Return the number of rows in result set
$rowcount = $query->rowCount();
$a=$rowcount/3;
$a= ceil($a);
for($b=1; $b<=$a; $b++)
{
?> <a style=" " href="index.php?page=<?php echo $b; ?>"><?php echo $b. " " ?> </a> <?php
}?>
</div>
</section>
But I want to align these numbering in this way:
This image exactly shows requirement of my result:
please anyone can help me. how to fix it. thanks
you should use a table as grid
Try this
<table>
<tr>
<?php
$numbers_per_row = 5;
$rowi= 0;
$numbers_limit = 25;
for($b=1; $b<=$numbers_limit ; $b++)
{
echo '<td><a href="index.php?page='.$b.'">'.$b.'</td>';
if($rowi<=$numbers_per_row) {
$rowi++;
}
else { echo '</tr><tr style="margin-top:10px;">';
/* <-- change it ^ to what you want */
/* Reset counter */
$rowi = 0; }
}
?>
</table>

switching between regular html and jQuery mobile site acting strange [duplicate]

I have a wordpress site, that need to show pages using swipe, I choose to use Jquery Mobile, and I get it working fine. Now, we have 2 languages on site, using wpml plugin. And my Swipe Code works well, except when we use Change language button swipe fails.
Details on issue.
We have only 3 Text Only page in our website, in 2 language. And in Footer we have link to change language. Also client hate to have Ajax page loading, so what I did is I create three Div with data-role=page and put data-next, data-prev as #div-$postid. So the navigation works absolute fine. I put footer outside from data-role=page.
Now, when I click change button in footer, it load the english page [I saw it using Fiddler] and then take first data-role=page from server and replace /slide its content. However since it only pick the first data role, all other english page doesn't get in HTML [it just update DOM and doesn't navigate to english version]. so swipe fails as other english pages are not in dom.
Also, footer is not changing, so what I want is: can we simple force a Link to navigate instead of going swipe way? Jquery Mobile is enforcing swipe on all A tags, I do not want swipe to works anything outside data-role=page.
Hope I make sense.
Edit here is code: [not sure if this code will help at all]
<?php
get_header();
global $post;
$args = array('post_type' => 'mobile_slide','showposts' => '-1', "order" => "DESC");
$the_query = new WP_Query($args);
if($the_query->have_posts()){
while($the_query->have_posts()) { $the_query->the_post();
$prev =get_previous_post();
$next =get_next_post();
if($prev) {
$prev = "#page-" . $prev->ID; //get_permalink($prev->ID);
} else {
$prev='';
}
if($next) {
$next = "#page-".$next->ID; //get_permalink($next->ID);
} else {
$next='';
}
if (has_post_thumbnail( $post->ID ) ) {
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'slider_image' ); ?>
<div id="page-<?php echo $post->ID; ?>" data-dom-cache="true" data-transition="slide" class="page" data-role="page" data-prev="<?php echo $prev; ?>" data-next="<?php echo $next; ?>" style="background-image:url('<?php echo $image[0]; ?>'); background-position:center center; background-color:#000; background-repeat:no-repeat; ">
<?php } else { ?>
<div id="page-<?php echo $post->ID; ?>" data-dom-cache="true" data-transition="slide" class="page" data-role="page" data-prev="<?php echo $prev; ?>" data-next="<?php echo $next; ?>">
<?php } ?>
<div class="post_box">
<h2><blockquote><?php the_title(); ?></blockquote></h2>
<div class="post_entry">
<?php the_content(); ?>
</div>
</div><!-- post_box -->
</div>
<?php }
} ?>
<?php get_footer(); ?>
This is all I have, except that get_footer use Ul li based list where on LI change based on language variable, to show different images for either language.
To stop Ajax from loading pages/links, add to link anchor data-rel="external" or data-ajax="false". This will load page normally without any transition.
Reference: jQuery Mobile - Links
For those who have similar problem, I fix it by using following:
1) I add a "noswipe" class to A Tag so I can refer it in Jquery
2) I add following code
$(function(){
$(".noswipe").click(function(){
window.location.href= $(this).attr("href");
return false;
});
});
The above code simply enforce to skip the Mobile's parsing and calling and works for my case.

Manually setting wordpress categories for fontface Icons

I'm editing the twenty eleven theme but I want to change the categories so they display the icons as a #fontface icon instead of a word.
The categories needs to look something like this (using an art category as an example):
<i class="icon-brush"></i>
However this is how it currently looks.
<span class="entry-utility-prep entry-utility-prep-cat-links">Posted in</span>Art
Here is what my code is at the moment:
<?php $show_sep = false; ?>
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
if ( $categories_list ):
?>
<span class="cat-links">
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
$show_sep = true; ?>
</span>
<?php endif;?>
<?php endif; // End if categories ?>
The class needs to change depending on what post category is set is there a way to manually set what icon links to which category?
You can view my live template here http://mhutchinson.me.uk/
Thanks for your help!
Megan
You might wanna try something like this:
(change the printed HTML inside the foreach to fit your needs)
<?php
foreach((get_the_category()) as $category) {
echo '<img src="http://example.com/images/' . $category->cat_ID . '.jpg" alt="' . $category->cat_name . '" />';
}
?>
Cheers