Element disappears on certain dimensions - html

I have this website and my problem is with the language switcher on top.
As you can see from the screenshots, when  the width is between 768 - 990 px the top bar disappears.
With top bar at 1175px x 621px
Without top bar at 896px x 489px
I have tried many css tricks that i found online, like
-webkit-transform: translate3d(0, 0, 0);
but i still have the same result
The HTML code is the menu from the website. I think the problem is being created by the class="style2"
P.S. At line 6315 of the css you can see the
#media (min-width: 768px) {...}
but i can't figure if something contributes to my problem.
<?php if((get_theme_mod('andaman_top_contact') || get_theme_mod('andaman_menu_soc')) == true) { ?>
<div class="header style2">
<div class="top_bar">
<div class="container">
<div class="row">
<div class="col-lg-10 col-md-9 col-sm-12 col-xs-12">
<?php if(get_theme_mod('andaman_top_contact') == true) { ?>
<ul class="contacts-top">
<?php if(get_theme_mod('andaman_top_contact_address', 'enable') == true) { ?><li><?php echo esc_attr(get_theme_mod('andaman_top_contact_address', '455 Martinson, Los Angeles')); ?></li><?php }; ?>
<?php if(get_theme_mod('andaman_top_contact_phone', 'enable') == true) { ?><li><?php echo esc_attr(get_theme_mod('andaman_top_contact_phone', '+1 (043) 567-8930')); ?></li><?php }; ?>
<?php if(get_theme_mod('andaman_top_contact_hours', 'enable') == true) { ?><li><?php echo esc_attr(get_theme_mod('andaman_top_contact_hours', 'Mon-Sut: 10 AM-8 PM')); ?></li><?php }; ?>
</ul>
<?php }; ?>
</div>
<div class="col-lg-2 col-md-3 col-sm-12 col-xs-12">
<ul class="soc-top">
<?php if ( is_plugin_active( 'polylang/polylang.php' )) { ?>
<li class="lang"><span><img src="<?php echo get_stylesheet_directory_uri(). '/assets/images/lang-' . pll_current_language('slug') . '.png'; ?>" width="24" height="24" alt=""> <?php echo pll_current_language('name'); ?></span>
<ul class="lang-ul">
<?php $languages = pll_the_languages( array('raw'=> true, 'hide_if_no_translation'=>true, 'hide_current'=>true) );
foreach ($languages as $language ) {
echo '<li><img src="'.get_stylesheet_directory_uri(). '/assets/images/lang-'.$language['slug'].'.png" width="24" height="24" alt="'.$language['slug'].'">' .$language['name'].'</li>'; }; ?>
</ul>
</li>
<?php }; ?>
</ul>
</div>
</div>
</div>
</div>
<?php } else { ?>
<div class="header style2 no-bar">
<?php };?>
<div class="sticky-menu">
<div class="container">
<div class="menu-flex">
<div class="logo">
<a href="<?php echo esc_url(home_url('/')); ?>" title="<?php bloginfo( 'name' ); ?>" rel="home">
<?php if(get_theme_mod('andaman_logo_upload', 'enable') == true) { ?>
<img src="<?php echo esc_url(get_theme_mod('andaman_logo_upload', get_template_directory_uri() . '/assets/images/logo.png')); ?>" alt="<?php the_title_attribute(); ?>" style="height: <?php echo esc_attr(get_theme_mod('andaman_logo_height', '45px')); ?>;">
<?php } else { ?>
<h1 style="margin:0;"><?php echo the_title(); ?></h1>
<?php } ?>
</a>
</div>
<?php if(get_theme_mod('andaman_menu_select', 'standard') == 'standard') { ?>
<div class="menu-responsive desktop">
<div class="navbar-main-collapse pull-left responsive-menu">
<?php wp_nav_menu( array(
'theme_location' => 'menu',
'container' => false,
'menu_class' => 'nav navbar-nav',
'sort_column' => 'menu_order',
'walker' => new Andaman_My_Walker_Nav_Menu(),
'fallback_cb' => 'andaman_MenuFallback'
)); ?>
</div>
</div>
<div class="menu-responsive mobile">
<div class="burger_andaman_normal_holder"><span></span><span></span><span></span><span></span><span></span><span></span></div>
<div class="burger_andaman_menu_overlay_normal">
<div class="burger_andaman_menu_vertical">
<?php wp_nav_menu( array(
'theme_location' => 'menu',
'menu_class' => 'burger_andaman_main_menu',
'depth' => 3,
)); ?>
</div>
</div>
</div>
<?php } else { ?>
<div class="menu-responsive desktop">
<div class="navbar-main-collapse pull-left responsive-menu">
<?php wp_nav_menu( array(
'theme_location' => 'onepage-menu',
'container' => false,
'menu_class' => 'nav navbar-nav share-class',
'menu_id' => 'menu-onepage',
'sort_column' => 'menu_order',
'walker' => new Andaman_My_Walker_Nav_Menu(),
'fallback_cb' => 'andaman_MenuFallback'
)); ?>
</div>
</div>
<div class="menu-responsive mobile">
<div class="burger_andaman_normal_holder"><span></span><span></span><span></span><span></span><span></span><span></span></div>
<div class="burger_andaman_menu_overlay_normal">
<div class="burger_andaman_menu_vertical">
<?php wp_nav_menu( array(
'theme_location' => 'onepage-menu',
'menu_class' => 'burger_andaman_main_menu share-class',
'menu_id' => 'menu-onepage',
'depth' => 1,
)); ?>
</div>
</div>
</div>
<?php } ?>
</div>
</div>
</div>
</div>

This is happening because one of your stylesheet hiding the li.lang between mentioned width, I have provided you CSS, you can paste it inside the stylesheet.
#media screen and (max-width:990px){
li.search, li.lang {
display: block !important;
}
}
Screenshot of your CSS: (You have to change display: none to display: block)

Thank you #Gamers Agenda for your quick and accurate answer.
The changes I made with your help:
#media screen and (max-width:990px){
.soc-top {
float: right;
margin-right: 30px;
}
li.search, li.lang {
display: block !important;
}
}

This will do:
Your style:
#media (max-width: 767px)
.header.style2 .soc-top {
float: none !important;
text-align: center;
}
remove float: none !important; and be like:
#media (max-width: 767px)
.header.style2 .soc-top {
text-align: center;
}

Related

Start new table row every 3 cells

I am using ACF to fetch yacht listings (custom post types) which are then output in a table.
I could try and lay these out as Divs but this particular design means it is much easier as a table (there are borders in between and fluctuating heights which I would like to display of equal height).
The problem is, as these are populated dynamically, I am unable to lay the table out in html and thus, can't find a way to only have 3 cells wide per table row.
Is there a way to have a new row automatically start every 3 cells? Furthermore, is there a way to alter this based on screen width.
Currently the posts are not set in a table in the HTML but in the CSS, but I have tried both.
My code is:
<div class="the-latest-listings">
<div class="listings-table-row">
<?php
$args = array(
'post_type' => 'yachts',
'posts_per_page' => 9,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'sale_or_charter',
'value' => 'sale',
)
),
);
$my_posts = new WP_Query($args);
if ( $my_posts->have_posts() ) {
while ( $my_posts->have_posts() ) : $my_posts->the_post();
?>
<div class='latest-yacht-wrapper'>
<div class="single-latest-yacht-container">
<div class="latest-yacht-image">
<?php
$image = get_field( "preview_yacht_image", get_the_ID() );?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo esc_url($image['url']); ?>" title="<?php echo esc_attr($image['title']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
</a>
</div>
<div class="latest-yacht-blue-container">
<div class="sale-status-tab">
<p><?php echo the_field( "sale_or_charter", get_the_ID() );?></p>
</div>
<h4><?php the_title(); ?></h4>
<div class="teaser-details">
<?php if( get_field('price', get_the_ID() ) ){ ?>
<p class="latest-price">EUR <?php echo get_field( "price", get_the_ID() );?></p>
<p class="divider">|</p>
<?php }; ?>
</div>
</div>
</div>
</div>
<div class="yacht-spacer">
<div class="vertical-line"></div>
</div>
<?php
endwhile;
wp_reset_postdata();
}
?>
</div>
</div>
And the CSS that is think is relevant to the question
#page .the-latest-listings {
border-top: 1.3px solid rgba(28,34,64,.3);
border-bottom: 1.3px solid rgba(28,34,64,.3);
margin-top: 60px;
display: table;
width: 100%;
table-layout: fixed;
}
.listings-table-row {
display: table-row;
}
.latest-yacht-wrapper {
display: table-cell;
}
.single-latest-yacht-container {
padding: 78px 0;
}
.yacht-spacer {
width: 50px;
display: table-cell;
position: relative;
}
I tried setting the .latest-yacht-wrapper to 33% width but it doesn't work. I also tried these:
while($('.the-latest-listings ').find('tr:last').children(':gt(2)').length > 0){
$('.the-latest-listings ').find('tr:last').after(
$('.the-latest-listings ').find('tr:last').children(':gt(2)')
.wrapAll('<tr></tr>').parent().remove()
);
}
AND
while($('.the-latest-listings').find('tr:last').children(':gt(2)').length > 0){
var newRow = '';
$('.the-latest-listings').find('tr:last').children(':gt(2)').each(function(i,e){
newRow += $(e).prop('outerHTML');
}).remove();
$('.the-latest-listings').find('tr:last').after('<tr>' + newRow + '</tr>');
}
I also tried switching to a table layout in the html like so:
<table class="the-latest-listings">
<tr class="listings-table-row">
<?php
$args = array(
'post_type' => 'yachts',
'posts_per_page' => 9,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'sale_or_charter',
'value' => 'sale',
)
),
);
$my_posts = new WP_Query($args);
if ( $my_posts->have_posts() ) {
while ( $my_posts->have_posts() ) : $my_posts->the_post();
?>
<td class='latest-yacht-wrapper'>
<div class="single-latest-yacht-container">
<div class="latest-yacht-image">
<?php
$image = get_field( "preview_yacht_image", get_the_ID() );?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo esc_url($image['url']); ?>" title="<?php echo esc_attr($image['title']); ?>" alt="<?php echo esc_attr($image['alt']); ?>" />
</a>
</div>
<div class="latest-yacht-blue-container">
<div class="sale-status-tab">
<p><?php echo the_field( "sale_or_charter", get_the_ID() );?></p>
</div>
<h4><?php the_title(); ?></h4>
<div class="teaser-details">
<?php if( get_field('price', get_the_ID() ) ){ ?>
<p class="latest-price">EUR <?php echo get_field( "price", get_the_ID() );?></p>
<p class="divider">|</p>
<?php }; ?>
</div>
</div>
</div>
</td>
<td class="yacht-spacer">
<div class="vertical-line"></div>
</td>
<?php
endwhile;
wp_reset_postdata();
}
?>
</tr>
</table>
And then this:
var $td = $(".listings-table-row td");
$td.each(function(i){
if (i % 3 == 0) {
$td.slice(i, i+3).wrapAll('<tr/>')
}
}).parent('tr').unwrap();
But again, no luck.
As I am writing this, I realise accounting for the spacers will mean it's not 3 TD's across but I can't get any to work regardless of what numbers I enter.
One of the following techniques could fit the bill:
https://youtu.be/qm0IfG1GyZU?t=711
https://youtu.be/qm0IfG1GyZU?t=184
RAM (Repeat, Auto, Minmax)
.ex7 .parent {
display: grid;
grid-gap: 1rem;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
<div class="parent white">
<div class="box pink">1</div>
<div class="box purple">2</div>
<div class="box blue">3</div>
<div class="box green">4</div>
</div>
The Deconstructed Pancake
.ex2 .parent {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.ex2 .box {
flex: 1 1 150px;
/* Stretching: */
flex: 0 1 150px;
/* No stretching: */
margin: 5px;
}
<div class="parent white">
<div class="box green">1</div>
<div class="box green">2</div>
<div class="box green">3</div>
</div>
(source https://1linelayouts.glitch.me/)

Moving element over image?

The title of my featured article is positioned via css, but the results are not showing up properly in every screen.
I tried to place "mvp-feat2-main-text" element before "mvp-feat2-main left relative".
Problem: Text is shown behind the image. I need the text to show on top of the image.
Here is the relevant code:
<section id="mvp-feat2-wrap" class="left relative">
<?php global $do_not_duplicate; global $post; $recent = new WP_Query(array( 'tag' => get_option('mvp_feat_posts_tags'), 'posts_per_page' => '1' )); while($recent->have_posts()) : $recent->the_post(); $do_not_duplicate[] = $post->ID; ?>
<div class="mvp-feat2-main left relative">
<a href="<?php the_permalink(); ?>" rel="bookmark">
<div class="mvp-feat2-main-img left relative">
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<?php the_post_thumbnail('mvp-post-thumb', array( 'class' => 'mvp-reg-img' )); ?>
<?php the_post_thumbnail('mvp-mid-thumb', array( 'class' => 'mvp-mob-img' )); ?>
<?php } ?>
<?php if ( has_post_format( 'video' )) { ?>
<div class="mvp-feat-vid-but">
<i class="fa fa-play fa-3"></i>
</div><!--mvpfeat-vid-but-->
<?php } else if ( has_post_format( 'gallery' )) { ?>
<div class="mvp-feat-gal-but">
<i class="fa fa-camera fa-3"></i>
</div><!--mvpfeat-gal-but-->
<?php } ?>
</div><!--mvp-feat2-main-img-->
<div class="mvp-feat2-main-text">
<h3 class="mvp-feat2-main-cat left"><span class="mvp-feat2-main-cat left"><?php $category = get_the_category(); echo esc_html( $category[0]->cat_name ); ?></span></h3>
<div class="mvp-feat2-main-title left relative">
<?php if(get_post_meta($post->ID, "mvp_featured_headline", true)): ?>
<h2><?php echo esc_html(get_post_meta($post->ID, "mvp_featured_headline", true)); ?></h2>
<?php else: ?>
<h2 class="mvp-stand-title"><?php the_title(); ?></h2>
<?php endif; ?>
</div><!--mvp-feat2-main-title-->
<div class="mvp-feat1-info">
<span class="mvp-blog-author"><?php esc_html_e( 'By', 'click-mag' ); ?> <?php the_author(); ?></span><span class="mvp-blog-date"><i class="fa fa-clock-o"></i><span class="mvp-blog-time"><?php the_time(get_option('date_format')); ?></span></span>
</div><!--mvp-feat1-info-->
</div><!--mvp-feat2-main-text-->
</a>
</div><!--mvp-feat2-main-->
Try to use
style="z-index:value">
on your html at then end where you want to have your element appear ontop of the image
Example:
<div class="mvp-feat2-main-text" style="z-index:99;">
the z-index value must larger then the z-index of the image so try to increase that value until it appears ontop.

Bootstrap and Wordpress position of navbar and logo

So I've tried adding a phone number to the correct places on my site, but it's not styling correctly. The problem I'm running into is the mobile display. The logo will not center, and the phone number is not showing inline in the navbar.
What I'm trying to achieve:
desktop mobile
What I have:
http://lakeozarkelectrician.com/
CSS:
// -------------- Mobile -------------- //
#media screen and (max-width: 480px) {
.navbar-brand {
padding-top: .3125rem;
padding-bottom: .3125rem;
font-size: 1.25rem;
line-height: inherit;
white-space: nowrap;
}
.img-fluid {
display: block;
margin: 0 auto;
}
a[href^="tel:"] {
color: white;
text-decoration: none;
float: none;
}
}
// ------------- Telephone Styling ------------ //
#telephone {
text-align: center;
margin-top: 15px;
font-size: large;
float: right;
}
a[href^="tel:"] {
color: black;
text-decoration: none;
display: inline;
}
Header:
<body <?php body_class(); ?>>
<div class="hfeed site" id="page">
<!-- ******* Header ******* -->
<header>
<div class="wrapper-fluid">
<!-- Your site title as branding in the menu -->
<div class="container">
<div class="row">
<div class="col-md-6">
<?php if ( ! has_custom_logo() ) { ?>
<?php if ( is_front_page() && is_home() ) : ?>
<h1 class="navbar-brand mb-0"><a rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php bloginfo( 'name' ); ?></a></h1>
<?php else : ?>
<a class="navbar-brand" rel="home" href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>"><?php bloginfo( 'name' ); ?></a>
<?php endif; ?>
<?php } else {
the_custom_logo();
} ?>
</div>
<!-- end custom logo -->
<div class="col-md-6 d-block hidden-md">
<div id="telephone">
<p>Call Now<br>
<i class="fa fa-phone"></i>
636-244-9045</p>
</div>
</div>
</div>
</div>
<!-- ******************* The Navbar Area ******************* -->
<div class="wrapper-fluid wrapper-navbar" id="wrapper-navbar">
<a class="skip-link screen-reader-text sr-only" href="#content"><?php esc_html_e( 'Skip to content',
'understrap' ); ?></a>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<?php if ( 'container' == $container ) : ?>
<div class="container">
<?php endif; ?>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<!-- The WordPress Menu goes here -->
<?php wp_nav_menu(
array(
'theme_location' => 'primary',
'container_class' => 'collapse navbar-collapse',
'container_id' => 'navbarNavDropdown',
'menu_class' => 'navbar-nav',
'fallback_cb' => '',
'menu_id' => 'main-menu',
'walker' => new WP_Bootstrap_Navwalker(),
)
); ?>
<?php if ( 'container' == $container ) : ?>
</div><!-- .container -->
<?php endif; ?>
<span class="navbar-text d-inline-block d-sm-none">
<i class="fa fa-phone"></i>
636-244-9045
</span>
</nav><!-- .site-navigation -->
</div><!-- .wrapper-navbar end -->
</div>
</header>
</div>
You can try with this :
#media screen and (max-width: 480px) {
.navbar-brand {
padding-top: .3125rem;
padding-bottom: .3125rem;
font-size: 1.25rem;
line-height: inherit;
white-space: nowrap;
margin-left: auto; // <-- add this
margin-right: auto; // <-- add this
display: table; // <-- add this
}
#telephone{display:none;} // <-- add this
.navbar > .container + span{ // <-- add this
position: absolute; // <-- add this
right: 15px; // <-- add this
top: 10px; // <-- add this
} // <-- add this
}
sorry because i know that its old but may useful
u can false container like below and add what ever you want
<div id="navbarNavDropdown" class="collapse navbar-collapse"><?php wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => false,
'menu_class' => 'navbar-nav',
'fallback_cb' => '',
'menu_id' => 'main-menu',
'walker' => new WP_Bootstrap_Navwalker(),
)
); ?><span class="nav-item">MY NEW ITEM</span></div>

html Element has no height

My element has no height, but it's filled with images now the Anchor around the images is not clickable unless i give .portfolio a fixed height.
Any suggestions on how to fix this?
THE HTML :
<h1 class="text-center">
Een greep uit ons portfolio
</h1>
<span class="main-underline"></span>
<div class="portfolio">
<?php
$args = array( 'post_type' => 'portfolio', 'posts_per_page' => 4 );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
?>
<div class="col-xs-12 col-sm-6 col-md-3">
<div class="portfolio-img">
<a href="<?php echo esc_url( get_permalink() ); ?>">
<?php the_post_thumbnail('portfolio',array('class' => 'img-responsive')); ?>
</a>
</div>
</div>
<?php endwhile; ?>
</div>
THE CSS:
/*PORTFOLIO*/
#main2 {
}
.portfolio {
}
.portfolio .portfolio-img img{
width:100%;
}
.portfolio .col-md-3 {
margin:0;
padding:0;
}
The result:
Thanks in advance
Set display of a to inline-block.

Centre a doubleclick ad

I'm not sure how to centre a doubleclick ad horizontally. After reading this similar question Centre align leaderboard ad, I'm using this code now
<div class="center">
<style type="text/css">
.center {
text-align: center;
margin: 0 auto;
}
</style>
AD CODE
</div>
But it doesn't work. Any ideas?
To clarify, the ad is being used on this website. http://worldgreendaily.com/
The total code on the page is:
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$page_layout = get_option(THEME_NAME."_page_layout");
//logo settings
$logo = get_option(THEME_NAME.'_logo');
$search = get_option(THEME_NAME.'_search');
//top banner
$topBanner = get_option(THEME_NAME."_top_banner");
$topBannerCode = get_option(THEME_NAME."_top_banner_code");
//fixed menu
$menuStyle = get_option(THEME_NAME."_menu_style");
$weatherSet = get_option(THEME_NAME."_weather");
$weather = OT_weather_forecast($_SERVER['REMOTE_ADDR']);
// header social icons
$socialHeader = get_option(THEME_NAME."_social_header");
$vimeo = get_option(THEME_NAME."_vimeo");
$twitter = get_option(THEME_NAME."_twitter");
$facebook = get_option(THEME_NAME."_facebook");
$googlepluss = get_option(THEME_NAME."_googlepluss");
$pinterest = get_option(THEME_NAME."_pinterest");
$tumblr = get_option(THEME_NAME."_tumblr");
$linkedin = get_option(THEME_NAME."_linkedin");
$dribbble = get_option(THEME_NAME."_dribbble");
$soundcloud = get_option(THEME_NAME."_soundcloud");
?>
<!-- BEGIN .boxed -->
<div class="boxed<?php echo $page_layout=="boxed" ? " active" : false; ?>">
<!-- BEGIN .header -->
<div class="header">
<!-- BEGIN .header-very-top -->
<div class="header-very-top">
<!-- BEGIN .wrapper -->
<div class="wrapper">
<div class="left">
<?php
if ( function_exists( 'register_nav_menus' )) {
$walker = new OT_Walker_Top;
$args = array(
'container' => '',
'theme_location' => 'top-menu',
'items_wrap' => '<ul class="ot-menu very-top-menu load-responsive" rel="'.__("Top Menu", THEME_NAME).'"><li><i class="fa fa-home"></i></li>%3$s</ul>',
'depth' => 3,
'walker' => $walker,
"echo" => false
);
if(has_nav_menu('top-menu')) {
echo wp_nav_menu($args);
}
}
?>
</div>
<?php if($weatherSet=="on") { ?>
<?php if(!isset($weather['error'])) { ?>
<div class="right">
<div class="weather-report">
<span><?php _e("Weather",THEME_NAME);?></span>
<b><?php echo $weather['country'].', '.$weather['city'];?></b>
<img src="<?php echo THEME_IMAGE_URL.$weather['image'];?>.png" alt="<?php echo $weather['country'].', '.$weather['city'];?>" />
<font class="weather-meter" style="background: <?php echo $weather['color'];?>;"><?php echo $weather['temp_'.get_option(THEME_NAME."_temperature")];?></font>
</div>
</div>
<?php
} else {
echo $weather['error'];
}
?>
<?php } ?>
<div class="clear-float"></div>
</div>
<div class="double-split"></div>
<!-- END .header-very-top -->
</div>
<!-- BEGIN .header-middle -->
<div class="header-middle">
<div class="wrapper">
<?php if($logo) { ?>
<div class="logo-image">
<h1><?php bloginfo('name'); ?></h1>
<img class="logo" src="<?php echo $logo;?>" alt="<?php bloginfo('name'); ?>" />
</div>
<?php } else { ?>
<div class="logo-text">
<h1><?php bloginfo('name'); ?></h1>
</div>
<?php } ?>
<?php if($topBanner=="on") { ?>
<div class="banner">
<div class="banner-block">
<?php echo stripslashes(do_shortcode($topBannerCode));?>
</div>
<?php if (is_pagetemplate_active("template-contact.php")) { ?>
<?php $contactID = ot_get_page('contact'); ?>
<div class="banner-info">
<span class="icon-default"> </span><?php _e("Sponsored Advert", THEME_NAME);?><span class="icon-default"> </span>
</div>
<?php } ?>
</div>
<?php } ?>
<div class="clear-float"></div>
</div>
<!-- END .header-middle -->
</div>
<!-- BEGIN .header-menu -->
<div class="header-menu<?php if($menuStyle=='on') { echo ' thisisfixed'; } ?>">
<div class="wrapper">
<?php
wp_reset_query();
if ( function_exists( 'register_nav_menus' )) {
$walker = new OT_Walker;
$args = array(
'container' => '',
'theme_location' => 'middle-menu',
'items_wrap' => '<ul class="%2$s main-menu" >%3$s</ul>',
'depth' => 3,
"echo" => false,
'walker' => $walker
);
if(has_nav_menu('middle-menu')) {
echo wp_nav_menu($args);
} else {
echo "<ul class=\"main-menu\"><li class=\"navi-none\">Please set up ".THEME_FULL_NAME." menu!</li></ul>";
}
}
?>
<?php if($search=="on") { ?>
<div class="right menu-search">
<form method="get" action="<?php echo home_url(); ?>" name="searchform" >
<input type="text" value="" placeholder="<?php _e("Search something..",THEME_NAME);?>" name="s" id="s"/>
<input type="submit" class="search-button" value=" " />
</form>
</div>
<?php } ?>
<div class="clear-float"></div>
</div>
<!-- END .header-menu -->
</div>
<!-- BEGIN .header-undermenu -->
<div class="header-undermenu">
<div class="wrapper">
<?php
if ( function_exists( 'register_nav_menus' )) {
$args = array(
'container' => '',
'theme_location' => 'third-menu',
"link_before" => '<i>',
"link_after" => '</i>' ,
'items_wrap' => '<ul class="secondary-menu" >%3$s</ul>',
'depth' => 1,
"echo" => false
);
if(has_nav_menu('third-menu')) {
echo wp_nav_menu($args);
}
}
?>
<div class="clear-float"></div>
</div>
<!-- END .header-undermenu -->
</div>
<!-- END .header -->
</div>
<?php wp_reset_query(); ?>
<div style="text-align: center; margin: 0 auto;"><!-- Test_WGD -->
<div id='div-gpt-ad-1419519536676-0' style='width:728px; height:90px;'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1419519536676-0'); });
</script></div>
</html>
If you put your css on the page instead of linking to an external css file you should be putting it inside the <head></head> tags. Your document should look something like this:
<html>
<head>
<style type="text/css">
.center {
text-align: center;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="center">AD CODE</div>
</body>
</html>
you can also use inline styling (which I would not recommend) if you wanted the styles near the div like your example:
<div style="text-align: center; margin: 0 auto;">AD CODE</div>
UPDATE
This is being pulled in from an iframe. What you need to do is find the id that I have pointed out in the below image:
Which is this:
<div id='div-gpt-ad-1419519536676-0' style='width:728px; height:90px;'>
and add margin: auto to it, like so:
<div id='div-gpt-ad-1419519536676-0' style='width:728px; height:90px; margin: auto;'>
That should center your image
div and style tags must be replaced.
<html>
<head>
<style type="text/css">
.center {
text-align: center;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="center">
AD CODE
</div>
</body>
</html>